Skip to content
Hazine

Cart Page with Saved for Later

Pro

Cart page with the active basket above a Saved for later list. Shoppers move lines in both directions without losing them, and only the basket counts toward the total. Use it for considered purchases.

How it differs. Two lists with moves in both directions: cart lines closed by a totals band, then a hairline grid of saved lines. Focus stays in the source list and one status message gives count and total.

pnpm dlx shadcn@latest add @hazine/cart-page-saved-for-later

Adds 2 files, 1 shadcn primitive (button), 2 Hazine items (@hazine/heading, @hazine/use-controllable-state), and 1 package (lucide-react).

First time? Add the registry to components.json
{
  "registries": {
    "@hazine": {
      "url": "https://api.hazine.dev/r/{name}.json",
      "headers": { "Authorization": "Bearer ${HAZINE_TOKEN}" }
    }
  }
}

Set HAZINE_TOKEN in your environment. The token comes with a Pro licence.

Props11

title
string = "Your cart"
headingLevel
HeadingLevel = 2
lines
CartLine[]
Both lists in one array. A line with `saved: true` sits in the saved list.
defaultLines
CartLine[] = DEFAULT_LINES
onLinesChange
(lines: CartLine[]) => void
shipping
CartShipping = DEFAULT_SHIPPING
deliveryNote
string = "Ships from Utrecht in 2 working days."
Shown after the item count in the intro sentence.
currency
string = "EUR"
locale
string = "en-US"
checkoutHref
string = "/checkout"
continueHref
string = "/"

Also accepts every prop of Omit< React.ComponentProps<"section">, "title" >.

Accessibility

Pattern
Cart structure, Button (APG, opens in a new tab)
Keyboard
Keyboard support for Cart Page with Saved for Later
KeyEffect
TabMoves through each cart line (product link, Save for later, Remove, Decrease quantity, Increase quantity), then checkout, then each saved line (product link, Move to cart, Remove). Move to cart on an out of stock line is disabled and skipped, with the reason in text beside the price
Enter or Space on Save for laterMoves the line to the saved list and moves focus to the cart line that takes its place, or to the empty cart heading
Enter or Space on Move to cartMoves the line to the end of the cart and moves focus to the saved line that takes its place, or to the Saved for later heading
Enter or Space on RemoveRemoves the line and moves focus to the line that takes its place in the same list. When the list is left empty, focus moves to the empty cart heading for a cart line, and to the Saved for later heading for a saved line (the empty cart heading when no line is left at all)
Enter or Space on Decrease or Increase quantityChanges the quantity by 1. At a limit the button stays focusable, reports as disabled and does nothing
Enter or Space on Move items to cartIn the empty cart, moves every available saved line to the cart and moves focus to the first of them
Screen reader

Section labelled by its heading, holding two lists, each labelled by its own heading. Quantity is a group of two named buttons, every move and remove button names its product, and one polite status region reports each change with the new item count and total.

  • Announces: {name} saved for later. {count} in cart, total {total}.
  • Announces: {name} moved to cart. {count} in cart, total {total}.
  • Announces: {name} removed from cart. {count} in cart, total {total}.
  • Announces: {name} removed from saved items. {count} in cart, total {total}.
  • Announces: Quantity {quantity}, {name}. {count} in cart, total {total}.
  • Announces: {count} moved to cart. {count} in cart, total {total}.
  • Announces: {name} saved for later. Your cart is empty.
  • Announces: {name} removed from cart. Your cart is empty.
  • Announces: {name} removed from saved items. Your cart is empty.
Reduced motion
No motion. Colour transitions only.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies4

  • button
  • @hazine/heading
  • @hazine/use-controllable-state
  • lucide-react

Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.

Tokens shipped0

None. The item is styled by the tokens your theme already has.

Other takes on this5

The same question answered with a different structure.

  • cart pages

    One frame per shipment, split into its lines and its own delivery and cost rail with checkout and remove all. A closing ledger sums shipments as rows. A removed shipment leaves a restore slot.

    shadcn add @hazine/cart-page-grouped-by-shipment

    Depends on button, @hazine/heading, @hazine/number-input-stepper-buttons, @hazine/use-controllable-state, lucide-react

  • cart pages

    Selection drives everything: total, item count and checkout label follow the selected lines, a bulk toolbar replaces the hint while any line is selected, and the rail says what stays behind.

    shadcn add @hazine/cart-page-selective-checkout

    Depends on button, @hazine/heading, @hazine/number-input-stepper-buttons, @hazine/use-controllable-state, lucide-react

  • cart pages

    One column with no rail: each line keeps its controls under its name, totals follow the last line as a receipt, and checkout sits inline at the end with no competing region.

    shadcn add @hazine/cart-page-single-column

    Depends on button, separator, @hazine/heading, @hazine/number-input-stepper-buttons, @hazine/use-controllable-state, lucide-react

  • cart pages

    Lines and rail share one frame and the rail stays pinned while lines scroll. Under 48rem the rail drops below and the total with checkout becomes a sticky bottom bar. Removed lines leave an undo row.

    shadcn add @hazine/cart-page-summary-rail

    Depends on button, input, label, @hazine/heading, @hazine/number-input-stepper-buttons, @hazine/use-controllable-state, lucide-react

  • cart pages

    Semantic table whose footer totals sit under the line total column. Below 48rem each row reflows to a stack of label and value pairs with the column labels as visible text.

    shadcn add @hazine/cart-page-table-layout

    Depends on button, table, @hazine/heading, @hazine/number-input-stepper-buttons, @hazine/use-controllable-state, lucide-react

More in Carts and Checkout