Skip to content

Price

Use Price to display the cost of an item or service. It formats the amount for the given currency and locale, and supports size, weight, strikethrough, and sale styling.

The SDK Price showing a formatted amount.
import { Price } from '/@dropins/tools/components.js';
PropTypeReq?Description
amountnumberNoThe price amount to format. Defaults to 0.
currencystring | nullNoThe currency code used to format the amount (for example, USD).
localestringNoThe locale used to format the amount (for example, en-US).
formatOptions{ [key: string]: any }NoNumber-formatting options passed to the price formatter. Defaults to an empty object.
variant'default' | 'strikethrough'NoThe display variant. Defaults to default.
weight'bold' | 'normal'NoThe font weight. Defaults to bold.
salebooleanNoApply sale styling. Defaults to false.
size'small' | 'medium' | 'large'NoThe price size. Defaults to small.

Price also accepts standard HTML attributes (for example, className), except size.

Render a formatted price for a given currency and locale.

import { Price, provider } from '/@dropins/tools/components.js';
await provider.render(Price, {
amount: 9.99,
currency: 'USD',
locale: 'en-US',
})(document.querySelector('.price'));
  • PriceRange — display a minimum-to-maximum price range.
  • Design tokens — the typography and color scales prices use.