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
<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.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
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.
| Prop | Type | Required | Description |
|---|---|---|---|
lines | RemixNode | Yes | The lines, usually a <ul> of CartLine. |
breakdown | RemixNode | Yes | The charges, usually a PriceBreakdown ending in its total. |
total | RemixNode | Yes | The order total, shown on the folded row so a phone sees it before unfolding. |
collapsible | boolean | No | Folds the summary below 56rem. @default false |
open | boolean | No | Starts a collapsible summary unfolded on a phone. @default false |
labels | Labels | Yes |
Also accepts everything in Omit<TagProps<"section">, "children">.