Price
ProA price with an optional billing period, a crossed-out old price and a savings badge.
Playground
Installation
Price comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import { Price, PriceProps } from "@wunderui/react"Then use it:
import { Price } from "@wunderui/react"
export function PlanPrice() {
return <Price amount="$39" period="/ seat / month" />
}Expected result: You should see $39 in large bold type with the grey note / seat / month beside it on the same baseline.
When to use
Use Price for
- A plan price with its billing period on a pricing card, a paywall or a plan picker
- A sale price on a product card, with the old price crossed out and the saving beside it
- Prices in an order summary, a cart or a list, where the sizes have to match
Use something else for
- Number Value for a headline figure with a caret and its change
- Trend Chip for only a change in a percentage, as a small pill
- Badge for a short label or status without an amount
Type
The parts you pass decide the type: amount and period make a plan price, amount and old price make a sale price, and a badge adds the saving. The amount is always required.
Size
Size sets the amount to 14, 24 or 36 px, with the period, old price and badge at 12 or 14 px beside it. Without a size, a price with a period is large and any other is small.
Amount
The amount is a finished string, so the currency sign and separators come with it, like $1,842.50. The component formats nothing; use tabular digits where prices stand in a column or change.
Period
The period is any text that follows the amount, such as / month or / seat / month. It is not translated or shortened, so write the note you need.
Width
The parts sit on one baseline. When the column is too narrow, the period, old price and badge move to the next line instead of being squeezed or pushed past the edge.
Behavior and motion
What the component renders and how it reads.
- Static
- Price is not interactive: no focus, no hover state, no state of its own, no handlers. Wrap it in your own link or button where the price should open something.
- Parts
- Only the amount is required. Period, old price and badge render only when you pass them, in that order, and Figma's plan, sale and sale badge types come from which you set.
- Size
- The size is small, medium or large; without one, a price with a period is large and any other is small. The amount is 14, 24 or 36 px; period and old price are 12 px, or 14 px at medium.
- Wrapping
- The row wraps when the column is too narrow: period, old price and badge move to the next line with 4 px between lines, and nothing is cut off. Add a no-wrap class to keep one line.
- Strings
- Every part takes any node, usually a string. Nothing is formatted, shortened or translated: write the currency sign, separators and period note you want, in English format.
- Digits
- Digits are proportional by default. Tabular numbers on the row apply to every part, because the setting is inherited.
- Old price
- The old price is a strikethrough element. The strikethrough is visual and screen readers do not all announce it, so put a hidden Was in front of the figure.
- Dark mode
- It uses the theme tokens for text and the red badge, so it follows the theme.
- Motion
- None. The price does not animate when a value changes.
- Reduced motion
- There is no motion, so reduced motion changes nothing.
Anatomy
The figure shows all four parts at the large size. In the DOM they come in this order: amount, period, old price, badge.
- data-slot="price"
A row on one baseline with 8 px between the parts, wrapping with 4 px between lines when the column is narrow. It is not interactive: you pass finished strings.
- 1
The amount in the foreground colour: 14 px semibold at small, 24 px bold at medium, 36 px bold with tight tracking at large.
- 2Optional
The period after the amount, in tertiary text at 12 px (14 px at medium), such as / month or / seat / month.
- 3Optional
The compare-at value struck through, in tertiary text at the same size as the period.
- 4Optional
A small red pill with the badge text, such as Save 18%. It is centred on the row, not on the baseline.
Best practices
- Do
Pass the amount as a finished string with its currency sign and English separators, such as $1,842.50. The component does not format numbers.
- Do
Set the size explicitly in lists and grids. Without it a price with a period is large and any other price is small, so a plan card and a product row can differ by accident.
- Do
Use tabular numbers where prices stand in a column or change while people watch, so digits keep their width and decimal points line up.
- Do
Put a hidden word such as Was in front of the old price. The strikethrough is visual only, and a screen reader may read the old price as a second price.
- Don’t
Don't pass an old price without a lower amount, or a badge that says something other than the saving. The old price and badge must agree with the figure beside them.
- Don’t
Don't build price text by hand in cards. A hand-made row loses the shared sizes, the baseline and the wrapping.
- Don’t
Don't use it for a figure with a change over time. For a KPI with a rising or falling arrow use Number Value.
API reference
One table. Price is a plain component, not a wrapper of a primitive, so it lists every prop and does not pass other props on to its element.
A row on one baseline with 8 px between the parts, wrapping with 4 px between lines when the column is narrow. It is not interactive: you pass finished strings.
| Prop | Type | Default | Description |
|---|---|---|---|
| amount required | ReactNode | — | The price as a finished string with its currency sign, for example or . It is not formatted for you. |
| period | ReactNode | — | The text after the amount, such as or . It also makes the default size large. |
| compareAt | ReactNode | — | The old price, shown struck through after the period. Pass it with a lower for a sale. |
| badge | ReactNode | — | The savings badge, a small red pill, for example . |
| size | "sm" | "md" | "lg" | period ? "lg" : "sm" | The size of the amount: 14, 24 or 36 px. The other parts stay small beside it. |
| className | string | — | Extra classes for the row, merged after its own. Use them for , or . |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("price")The full library index for assistants is at /llms.txt.