Price
Prices are used to display the price of a given product, discount and total values.
Importโ
import { Price } from '@faststore/ui'
Usageโ
62.5
Variantsโ
Installmentโ
62.5
Listingโ
62.5
Savingsโ
62.5
Sellingโ
62.5
Spotโ
62.5
Examplesโ
INTL Formatted to partsโ
$62.50
INTL Formattedโ
โฌ62.50
Customโ
62,5 reais
Propsโ
as
ElementType<any>
Description
Set the HTML element tag of this component.
testId
string
Description
ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
Default value
store-price
value
*number
Description
The raw price value.
formatter
PriceFormatter
Description
Formatter function that transforms the raw price value and render the result.
Default value
(price) => price
variant
PriceVariant
Description
The current use case variant for prices.
Default value
selling
Customizationโ
data-store-price
data-variant
Formatter function exampleโ
function customFormatter(price: number) {
const unformattedPrice = `${price}`
const formattedPrice = `${unformattedPrice.replace('.', ',')} reais`
return formattedPrice
},