Price
A product's price as a shop shows it.
$45.00
$36.00Was $45.00Save 20%
From $29.00or 4 × $7.25
View code
<Price amount={4500} currency="USD" />
<Price amount={3600} currency="USD" compareAt={4500} size="lg" />
<Price amount={2900} currency="USD" from installments={4} />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 { Price } from "@sdxc/ui/commerce";Renders the price. A compare-at price at or below amount is ignored, so a stale sale
price never shows a negative saving.
Examples
<Price amount={2900} currency="EUR" locale="de-DE" from installments={4} />Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | The price in the currency's minor units. |
currency | string | Yes | The ISO 4217 code, such as USD. |
locale | string | No | |
compareAt | number | No | The earlier price in minor units; drawn struck through only when above amount. |
from | boolean | No | Marks amount as the lowest of several prices, such as the smallest size. |
installments | number | No | Splits the price into this many payments; a line shows the first share when 2 or more. |
size | "sm" | "md" | "lg" | No | |
labels | Partial<Labels> | No | |
inline | boolean | No | Draws the price as a <span>, for a price inside a line of text. @default false |
id | string | No |