import { Container, Typography } from '@toptal/picasso' import { SPACING_4, formatAmount } from '@toptal/picasso-utils' import React from 'react' const exampleAmount1 = 1575 const exampleAmount2 = '890' const Example = () => (
This component exposes a currency formatting utility, which converts numbers, into string decorated with currency symbols/codes in the required locale format. Without using Amount format helper This is an example pure string usage of the amount ${exampleAmount1} and{' '} €{exampleAmount2}. Using Amount format helper This is an example pure string usage of the amount{' '} {formatAmount({ amount: exampleAmount1 })} and{' '} {formatAmount({ amount: exampleAmount2, currency: 'EUR' })}. Using fraction digits options: minimumFractionDigits: 3 with value: {exampleAmount1} output:{' '} {formatAmount({ amount: exampleAmount1, options: { minimumFractionDigits: 3 }, })} minimumFractionDigits: 1 with value: 1575.1234 output:{' '} {formatAmount({ amount: 890.1234, options: { maximumFractionDigits: 1 }, currency: 'EUR', })}
) export default Example