What the person is about to pay for: the lines with quantity, a promo code, the discount, the tax and the total due, with a note on what renews. Amounts are cents; the code check is your callback.
Used for
- Checkout sidebar
- Plan change review
- Cart
- Invoice preview
Examples
Tax
Installation
npx knowns-ui@latest add order-summaryFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Order summary from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/order-summary
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add order-summary
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/kbd.tsx
- components/ui/knowns/field-class.ts
- components/ui/knowns/textarea.tsx
- components/ui/knowns/chat-composer/use-autosize.ts
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/input.tsx
- components/ui/knowns/blocks/checkout/order-summary.tsx
- components/ui/knowns/blocks/checkout/checkout-utils.ts
- components/ui/knowns/card-input/card-input-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/order-summary, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "order-summary" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- lines
{ id, name, detail?, amount, quantity? }[]- What is bought. amount is the price of one, in cents.
- currency / locale
string- Default
"usd" / "en-US" - How money reads.
- promo / onPromoChange
Promo|null / (promo) => void- The applied code, controlled. Leave it out and the summary keeps its own.
- onApplyPromo
(code, signal) => Promise<Promo>- Checks a code. Resolve with { code, label?, percentOff? | amountOff? }; throw an Error with the reason to refuse it. Without it there is no code field.
- tax
{ label, rate?, amount?, inclusive? }|null- A rate on the discounted subtotal, or a fixed amount from your provider. inclusive shows it without adding it.
- taxNote
ReactNode- Default
"Calculated at payment" - Shown in the tax row when there is no tax line.
- totalLabel / note
string / ReactNode- Default
"Due today" / - - The total's label and a line under it about what renews.
- title / surface
ReactNode|null / boolean- Default
"Order summary" / true - The heading, and whether it draws its own card.
| Prop | Type | Default | Description |
|---|---|---|---|
| lines | { id, name, detail?, amount, quantity? }[] | - | What is bought. amount is the price of one, in cents. |
| currency / locale | string | "usd" / "en-US" | How money reads. |
| promo / onPromoChange | Promo | null / (promo) => void | - | The applied code, controlled. Leave it out and the summary keeps its own. |
| onApplyPromo | (code, signal) => Promise<Promo> | - | Checks a code. Resolve with { code, label?, percentOff? | amountOff? }; throw an Error with the reason to refuse it. Without it there is no code field. |
| tax | { label, rate?, amount?, inclusive? } | null | - | A rate on the discounted subtotal, or a fixed amount from your provider. inclusive shows it without adding it. |
| taxNote | ReactNode | "Calculated at payment" | Shown in the tax row when there is no tax line. |
| totalLabel / note | string / ReactNode | "Due today" / - | The total's label and a line under it about what renews. |
| title / surface | ReactNode | null / boolean | "Order summary" / true | The heading, and whether it draws its own card. |
Accessibility
- The totals are a description list, so each amount is read with its label.
- Enter in the code field applies it; Escape closes the field and focus goes back to Add promo code.
- A refused code is announced (role alert) and focus stays in the field to fix it.
- The remove button on the chip is named after the code: Remove LAUNCH40.
What it handles
- 01Lists what is being bought with quantity and a second line, and adds it up in cents so the total never drifts.
- 02Opens a promo code field from a quiet link, checks it through your callback with an AbortSignal, and shows why a code was refused.
- 03Shows an applied code as a chip you can remove, with its discount row, and never discounts past the subtotal.
- 04Adds tax from a rate or a fixed amount, shows tax that is already included, or says it is worked out at payment.
- 05Ends on the total due and a line on what renews and when.
States
- First render
- Nothing moves
- none
- Add promo code
- The field folds open
- 180ms, ease out
- Checking a code
- The Apply button spins
- until it answers
- Code refused
- The reason shows under the field
- none
- Reduced motion
- The field opens at once
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing moves | none |
| Add promo code | The field folds open | 180ms, ease out |
| Checking a code | The Apply button spins | until it answers |
| Code refused | The reason shows under the field | none |
| Reduced motion | The field opens at once | 0ms |
Works with
When to use
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Order Summary to my app and wire it to my own data.
- I need the lines, promo code, tax and total beside a pay step or a plan change. Set that up with the Knowns UI Order Summary.
- Which Order Summary props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "order-summary" }) and search_docs({ query: "order summary" }).