Felt uses numbro.js to enable custom formatting of numeric attributes. Refer to the examples below to get started. For a more detailed overview of options, visit their documentation and code examples.
Numbers
Number | Format | String |
10000 | {
"thousandSeparated": true,
"mantissa": 4
} | 10,000.0000 |
10000.23 | {
"thousandSeparated": true
} | 10,000.23 |
10000.23 | {
"thousandSeparated": true,
"forceSign": true
} | +10,000.23 |
-10000 | {
"thousandSeparated": true,
"mantissa": 1
} | -10,000.0 |
10000.1234 | {
"mantissa": 3
} | 10000.123 |
10000.1234 | {
"optionalMantissa": true,
"mantissa": 5
} | 10000.12340 |
1.23 | {
"trimMantissa": true,
"mantissa": 4
} | 1.23 |
1.234 | {
"trimMantissa": true,
"mantissa": 4
} | 1.234 |
1.2345 | {
"trimMantissa": true,
"mantissa": 4
} | 1.2345 |
1.23456 | {
"trimMantissa": true,
"mantissa": 4
} | 1.2346 |
-10000 | {
"thousandSeparated": true,
"negative": "parenthesis",
"mantissa": 4
} | (10,000.0000) |
-0.23 | {
"mantissa": 2
} | -0.23 |
-0.23 | {
"negative": "parenthesis",
"mantissa": 2
} | (0.23) |
0.23 | {
"mantissa": 5
} | 0.23000 |
1230974 | {
"average": true,
"mantissa": 1
} | 1.2m |
1460 | {
"spaceSeparated": true,
"average": true
} | 1 k |
-104000 | {
"spaceSeparated": false,
"average": true
} | -104k |
233434 | {
"average": true,
"mantissa": 2,
} | 233.43k |
233000 | {
"average": true,
"mantissa": 2,
} | 233.00k |
1 | {
"output": "ordinal"
} | 1st |
52 | {
"output": "ordinal"
} | 52nd |
23 | {
"output": "ordinal"
} | 23rd |
100 | {
"output": "ordinal"
} | 100th |
Average
numbro provides an easy mechanism to round up any number with the keyÂ
average
Number | Format | String |