Order Summary
ProNewSubtotal, shipping, tax and discounts, then the total set apart, with a slot for a promo field and the checkout button.
Installation
pnpm dlx shadcn@latest add @viewport/order-summary
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
The code behind the preview above comes with Truffle Pro.
Props
| Prop | Type | Default |
|---|---|---|
| title | stringThe heading. | "Order summary" |
| lines* | SummaryLine[]Subtotal, shipping, tax and discounts, in order. | — |
| total* | { label?: string; value: string; hint?: string }The amount to pay. | — |
| children | React.ReactNodeA promo code field, a checkout button, trust notes: placed under the total. | — |
Accessibility
- A description list, so each amount is read with its label.
- Tabular numerals aligned to the end for comparing down the column.
- Discounts are marked with a minus sign as well as color.
- Server component with no client JavaScript.