Skip to content
Hazine

Cart Page Grouped by Shipment

Pro

Marketplace cart that nests lines in one frame per seller, each with its own delivery window, shipping cost, total and checkout. A closing ledger sums the shipments. Use when one order ships as several parcels.

How it differs. 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.

pnpm dlx shadcn@latest add @hazine/cart-page-grouped-by-shipment

Adds 1 file, 1 shadcn primitive (button), 3 Hazine items (@hazine/heading, @hazine/number-input-stepper-buttons, @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.

Props9

title
string = "Your cart"
headingLevel
HeadingLevel = 2
shipments
CartShipment[]
defaultShipments
CartShipment[] = DEFAULT_SHIPMENTS
onShipmentsChange
(shipments: CartShipment[]) => void
currency
string = "EUR"
locale
string = "en-US"
checkoutHref
string = "/checkout"
Checkout for every shipment at once.
continueHref
string = "/"

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

Accessibility

Pattern
Cart structure, Button (APG, opens in a new tab), Landmarks and headings, Spinbutton (APG, opens in a new tab)
Keyboard
Keyboard support for Cart Page Grouped by Shipment
KeyEffect
TabMoves through each shipment in order: product link, quantity and remove for every line, then check out this shipment and remove all. A removed shipment leaves one Restore button in its place. The combined checkout comes last
Arrow Up, Arrow DownChanges the focused quantity by 1, stopping at 1 and at the line limit. Page Up and Page Down change it by 10, Home and End set 1 or the limit
EnterCommits a typed quantity. Leaving the field does the same and Escape discards it
Enter or Space on RemoveRemoves the line and moves focus to the line that takes its place. Removing the last line removes the shipment
Enter or Space on Remove allRemoves the shipment, leaves a restore slot in its place and moves focus to Restore
Enter or Space on RestorePuts the shipment back where it was and moves focus to its seller heading
Screen reader

Section labelled by its title. Each shipment is a group named by its seller heading with a nested list of lines. Quantity is a spinbutton named after the product, group actions name their seller, and the grand total sits in a status region.

  • Announces: {name}, quantity {quantity}.
  • Announces: {name} removed from cart.
  • Announces: Shipment from {seller} removed, {count} items.
  • Announces: Shipment from {seller} restored.
  • Announces: Total, {count} shipments {total}, {subtotal} items + {shipping} shipping
Reduced motion
No motion. Colour transitions only.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies5

  • button
  • @hazine/heading
  • @hazine/number-input-stepper-buttons
  • @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

    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.

    shadcn add @hazine/cart-page-saved-for-later

    Depends on button, @hazine/heading, @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