Price
Price display with currency symbol, thousands separators and configurable decimals, plus original price (original), price range (min + max) and trend arrows (trend + trend-value). Formatting uses Intl.NumberFormat, and the symbol/number order follows the real Intl part order (so locales such as de-DE that place the symbol after the number work correctly).
Basic usage
value is a numeric string and currency is an ISO 4217 code (default CNY); original renders a struck-through original price.
Single value + original price
Currency and locale
locale defaults to the document <html lang> and can be overridden; precision controls decimals (0 hides them).
Currencies / locales
Price range
With both min and max present and no value, a range is rendered (single value wins):
Range
Trend
trend="up" / trend="down" renders a directional arrow and semantic color; numeric trend-value gets a sign and %, other text renders as-is. Up defaults to the danger color and down to success (Chinese market convention), both overridable via CSS variables.
Trend
Size
size="sm|md|lg" switches the three-level type scale (default md):
Sizes
API
oas-price
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
currency | ISO 4217 currency code, default CNY; invalid codes fall back to the default | — | — |
locale | Intl.NumberFormat locale; defaults to the document <html lang>, then en | — | — |
max | Range upper bound (effective with min when value is absent) | — | — |
min | Range lower bound (effective with max when value is absent) | — | — |
original | Struck-through original price (rendered as <s> with an "Original price" screen-reader prefix) | — | — |
precision | Decimal places (integer 0–20, default 2; invalid values fall back) | — | — |
size | Size step: sm / md (default) / lg | PriceSize | — |
trend | Trend direction: up / down; invalid values render no trend | — | — |
trend-value | Change text (numeric values get a sign and %, other text renders as-is) | — | — |
value | Single price (numeric string); wins over min + max when both are present | — | — |
CSS Variables
| CSS Variable | Default |
|---|---|
--oas-price-color | var(--oas-color-text-primary) |
--oas-price-down-color | var(--oas-color-success-text) |
--oas-price-original-color | var(--oas-color-text-secondary) |
--oas-price-up-color | var(--oas-color-danger-text) |