Vibary.ai
← Vibe Coding

Cart Quantity Stepper

Stepping the quantity rolls the count and both totals in the direction of the change.

commercefriendlyminimalinteraction · finite · starter · ~0.3s
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.

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

/**
 * Vibary · Cart Quantity Stepper
 *
 * Change the quantity and every figure that depends on it rolls in the
 * direction of the change: up for more, down for less. The digits

About this pattern

A cart line where every figure downstream of the stepper answers it. The outgoing number leaves the way the new one arrives, so the roll itself carries the direction — up for more, down for less — and the cart sum travels a shorter distance than the line total, which reads as a consequence rather than a second announcement competing with the first. Figures sit in fixed-width tabular slots so a 9 becoming a 10 cannot nudge the row sideways, and they translate and crossfade rather than scaling: the one thing a shopper must trust at a glance is the number.

Cart line quantityBasket item adjustmentOrder quantity pickerSubscription unit count

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

    Adjusting an item's count animates the line and basket figures in the direction of the change.

Related patterns