SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

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
tsx
<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.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
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

tsx
<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.

PropTypeRequiredDescription
amountnumberYesThe price in the currency's minor units.
currencystringYesThe ISO 4217 code, such as USD.
localestringNo
compareAtnumberNoThe earlier price in minor units; drawn struck through only when above amount.
frombooleanNoMarks amount as the lowest of several prices, such as the smallest size.
installmentsnumberNoSplits the price into this many payments; a line shows the first share when 2 or more.
size"sm" | "md" | "lg"No
labelsPartial<Labels>No
inlinebooleanNoDraws the price as a <span>, for a price inside a line of text. @default false
idstringNo
@sdxc/ui

Can’t find it? Contact us