PriceBreakdown
A receipt block as a <dl>.
View code
<PriceBreakdown note="You won't be charged yet">
<PriceBreakdown.Line label="4 nights" detail="$182 × 4 nights" amount="$728.00" name="nights" />
<PriceBreakdown.Line label="Cleaning fee" amount="$45.00" />
<PriceBreakdown.Line label="Service fee" amount="$61.10" />
<PriceBreakdown.Line label="Weekly stay discount" amount="$72.80" tone="discount" />
<PriceBreakdown.Total label="Total (USD)" amount="$761.30" name="total" />
</PriceBreakdown>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 { PriceBreakdown } from "@sdxc/ui/travel";Renders the receipt: a <dl> whose lines each pair a <dt> label with a <dd> amount,
so the pairing survives in the accessibility tree, and the note centred beneath it.
Composition
The parts the component publishes, each a static property of the host.
PriceBreakdownPriceBreakdown.LineRenders one charge: its label, the working under it in muted small type, and its amount at the end.PriceBreakdown.TotalRenders the total: the same columns as a line, set bold and a step larger under a rule that closes off the charges above it.
Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
note | RemixNode | No | Small muted text under the total, such as "You won't be charged yet"; it sits after the <dl>, since a description list holds only label/value groups. |
Also accepts everything in TagProps<"div">.
PriceBreakdown.Line
| Prop | Type | Required | Description |
|---|---|---|---|
detail | RemixNode | No | How the amount was worked out, such as "$182 × 4 nights", in small type beneath. |
tone | "default" | "discount" | No |
Also accepts everything in AmountProps.
PriceBreakdown.Total
Also accepts everything in AmountProps.
Types
| Name | Values | What it decides |
|---|---|---|
Tone | "default" | "discount" | "discount" colours the line green and signs its amount with a minus. |