Skip to content
Hazine

Single Column Cart Page

Pro

Narrow, centred cart where lines, a delivery note, a dotted-leader ledger, the total and checkout stack in one reading column. Use for small catalogs that want a calm, editorial basket.

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

pnpm dlx shadcn@latest add @hazine/cart-page-single-column

Adds 2 files, 2 shadcn primitives (button, separator), 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.

Props14

title
string = "Your basket"
headingLevel
HeadingLevel = 2
lines
CartLine[]
defaultLines
CartLine[] = DEFAULT_LINES
onLinesChange
(lines: CartLine[]) => void
shipping
CartShipping = DEFAULT_SHIPPING
delivery
CartDelivery = DEFAULT_DELIVERY
discount
CartDiscount | null = DEFAULT_DISCOUNT
Pass `null` for a basket without a discount row.
currency
string = "EUR"
ISO 4217 code.
locale
string = "en-US"
checkoutHref
string = "/checkout"
continueHref
string = "/"
loading
boolean = false
Shows a skeleton of the column while the basket is being fetched.
error
string
What went wrong and what to do next. Announced as an alert.

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

Accessibility

Pattern
Cart structure, Landmarks and headings, Spinbutton (APG, opens in a new tab)
Keyboard
Keyboard support for Single Column Cart Page
KeyEffect
TabMoves through continue shopping, then product link, quantity and remove for each line, then checkout. The step buttons are skipped
Arrow Up, Arrow DownChanges the focused quantity by 1, stopping at 1 and at the line limit
Page Up, Page DownChanges the focused quantity by 10
Home, EndSets the focused quantity to 1 or, when the line has one, to its limit
EnterCommits a typed quantity. Escape discards it
Enter or Space on RemoveRemoves the line and moves focus to the line that takes its place, or to the empty state heading
Screen reader

Section labelled by its heading. Lines are a named list, quantity is a spinbutton named after the product, remove names the product, totals are a description list and the total sits in a status region.

  • Announces: {name} removed from basket.
  • Announces: Total {total} {subtotal} items − {discount} discount + {delivery} delivery
  • Announces: Loading your basket.
  • Announces: {error}
Reduced motion
The loading skeleton does not pulse. Colour transitions only.
Checked
Not checked yet. Automated results appear here once CI has run.

Dependencies6

  • button
  • separator
  • @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

    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

    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

    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