Vibary.ai
← Vibe Coding

Cart Item Remove

A removed line collapses its own height and gap while the survivors travel up and the total falls.

commercecalmminimalinteraction · finite · intermediate · ~0.5s
Interactive · click to play
Variant

The animated component in this preview is rendered from the canonical file shown here. The surrounding demo shell only provides context and is not part of the copied code.

363 lines · react + motion only
import { useState } from "react";
import { AnimatePresence, motion, useReducedMotion } from "motion/react";

/**
 * Vibary · Cart Item Remove
 *
 * A removed line collapses its own height and takes the gap with it, the
 * lines beneath travel up into the space, and the total rolls down to

About this pattern

Taking something out of a bag is an edit, not an event. The leaving line collapses its height and its own bottom gap together, so the list closes flush instead of leaving a seam; the lines beneath travel up on a position-only layout animation, which moves them without stretching the type inside; and the subtotal rolls downward at a constant size. The collapse is an eased tween rather than a spring — a closing gap that springs makes the list look like it is breathing. An empty line waits behind the list so the last removal closes onto a sentence rather than onto nothing.

Removing a line from a bagCart drawer editingSaved-items list managementOrder review before paying

Where it shows up

Screens we drew to show where this motion usually sits. Illustrations, not captures of any product.

  • Your bag
    Ridgeline GT — Bone, US 9−1+$132.00
    Merino crew sock, 2-pack−2+$24.00
    Subtotal$156.00Shipping$0.00Tax$13.65Total$169.65
    Checkout
    Cart

    A removed bag line closes its space and the summary restates itself underneath.

Related patterns