Demos
Default numbers
Code Editor
<P> <NumberFormat value="12345" srLabel="Total:" /> <NumberFormat>-12345678.9</NumberFormat> <NumberFormat prefix={<b>prefix</b>} suffix="suffix"> -12345678.9 </NumberFormat> <NumberFormat decimals={1}>-1234.54321</NumberFormat> <NumberFormat decimals={2} copy_selection={false}> -1234 </NumberFormat> <NumberFormat decimals={2}>invalid</NumberFormat> </P>
Currency
Code Editor
<P> <NumberFormat currency>12345</NumberFormat> <NumberFormat currency currency_position="before" value={-12345678.9} /> <NumberFormat currency value={-12345678.95} decimals={0} /> <NumberFormat currency value={-12345678.9} currency_display="code" /> <NumberFormat currency value={-12345678.9} currency_display={false} /> <NumberFormat currency decimals={2}> invalid </NumberFormat> </P>
Compact (shorten) numbers
Shorten numbers should only be used for numbers above 100 000. A small k
for thousand is not a Norwegian standard, and should not be used in formal contexts.
Code Editor
<P> <NumberFormat compact decimals={1}> 1234 </NumberFormat> <NumberFormat compact decimals={1} value={123456} /> <NumberFormat compact="short" decimals={2} value={-1723967.38} /> <NumberFormat compact="long" decimals={3} value={-1234567.9876} /> <NumberFormat compact="long" currency value={12345} decimals={1} currency_display="name" /> <NumberFormat compact value={123455678912} decimals={3} /> </P>