SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

On this page

OrderSummary

What a checkout is buying: the lines and the price breakdown.

Show order summary€84.15

Order summary

  • Tidepool50×70 · Oak frame€64.00
  • Fern studyInstant download€20.00
Subtotal
€84.00
Shipping
€4.95
WALLS10
−€4.80
Total
€84.15
View code
tsx
<OrderSummary
	collapsible
	lines={<ul>{cart.lines.map((line) => <CartLine name={line.title} details={line.variant} price={line.price} />)}</ul>}
	breakdown={
		<PriceBreakdown>
			<PriceBreakdown.Line label="Subtotal" amount="€84.00" />
			<PriceBreakdown.Line label="Shipping" amount="€4.95" />
			<PriceBreakdown.Line label="WALLS10" amount="€4.80" tone="discount" />
			<PriceBreakdown.Total label="Total" amount="€84.15" />
		</PriceBreakdown>
	}
	total="€84.15"
	labels={{ show: "Show order summary", heading: "Order summary" }}
/>

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { OrderSummary } from "@sdxc/ui/commerce";

Renders the heading, lines and breakdown. A collapsible summary is a <details> whose summary row shows on narrow screens only; from 56rem the row hides and the content shows whether or not the disclosure is open, through ::details-content.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
linesRemixNodeYesThe lines, usually a <ul> of CartLine.
breakdownRemixNodeYesThe charges, usually a PriceBreakdown ending in its total.
totalRemixNodeYesThe order total, shown on the folded row so a phone sees it before unfolding.
collapsiblebooleanNoFolds the summary below 56rem. @default false
openbooleanNoStarts a collapsible summary unfolded on a phone. @default false
labelsLabelsYes

Also accepts everything in Omit<TagProps<"section">, "children">.

@sdxc/ui

Can’t find it? Contact us