Skip to main content

number Field Type

type: 'number' renders a numeric value using toLocaleString(), which formats with locale-appropriate thousands separators. Non-numeric values fall back to a plain string. Use formatter when you need precision control, units, or sign display.

Core Examples​

Basic Number Rendering​

Score, sessions, and salary rendered as numbers. Thousands separators are applied automatically.

Name
Score
Sessions
Salary
Aurora Chen91.54,820118,000
Mateo Silva741,03595,500
Priya Nair88.2522,410107,250
fields: [
{ key: 'score', label: 'Score', type: 'number' },
{ key: 'sessions', label: 'Sessions', type: 'number' },
{ key: 'salary', label: 'Salary', type: 'number' },
]

Alignment​

Numeric columns are conventionally right-aligned so decimal points and digit groups visually stack. The default align is 'left' — set align: 'right' on each number field.

Same fields with align: 'right'. Values line up on the right edge of each column.

Name
Score
Sessions
Salary
Aurora Chen91.54,820118,000
Mateo Silva741,03595,500
Priya Nair88.2522,410107,250
{ key: 'score', label: 'Score', type: 'number', align: 'right' },
{ key: 'sessions', label: 'Sessions', type: 'number', align: 'right' },
{ key: 'salary', label: 'Salary', type: 'number', align: 'right' },

Formatter​

formatter receives (value, entity) and returns the display value. Use it to control decimal places, compact notation, unit suffixes, or sign display.

Score to 2 decimal places; Salary in compact notation (e.g. 118K); Change with explicit sign and % suffix.

Name
Score (2dp)
Salary (compact)
Change (%)
Aurora Chen91.50118K+12.4%
Mateo Silva74.0095.5K-3.7%
Priya Nair88.25107.3K+5.0%
{
key: 'score',
label: 'Score (2dp)',
type: 'number',
align: 'right',
formatter: (value) =>
typeof value === 'number' ? value.toFixed(2) : String(value ?? ''),
},
{
key: 'salary',
label: 'Salary (compact)',
type: 'number',
align: 'right',
formatter: (value) =>
typeof value === 'number'
? new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 }).format(value)
: String(value ?? ''),
},
{
key: 'change',
label: 'Change (%)',
type: 'number',
align: 'right',
formatter: (value) =>
typeof value === 'number'
? (value >= 0 ? '+' : '') + value.toFixed(1) + '%'
: String(value ?? ''),
},

Condition​

condition receives the full entity and returns true to show the field or false to hide it. Evaluated per row.

Salary column only renders for rows where Score is 85 or above. Mateo (74) gets no Salary cell.

Name
Score
Salary (score ≥ 85)
Aurora Chen91.5118,000
Mateo Silva74
Priya Nair88.25107,250
{
key: 'salary',
label: 'Salary (score ≥ 85)',
type: 'number',
align: 'right',
condition: (entity) => typeof entity.score === 'number' && entity.score >= 85,
},

Field Options Reference​

OptionTypeDefaultEffect
keystringrequiredEntity property to read the value from.
labelstringunsetColumn header or card label.
type'number'—Renders via toLocaleString(). Falls back to String(value) for non-numbers.
align'left', 'center', 'right''left'Use 'right' for numeric columns to stack digit groups vertically.
formatter(value, entity) => unknownunsetTransform before display: precision, units, sign, compact notation.
condition(entity) => booleanunsetHides the field for rows where the function returns false.
widthCSS length or numberunsetColumn width in table mode.
wraptrue, falseinheritedfalse: single line. true: wraps (rarely needed for numbers).
showLabeltrue, falsetrue when label is setShows or hides the label in card/grid layouts.
renderAsstringunsetReplace number rendering entirely. Useful with currency, progress, deltaValue, rating, scoreMeter, sparkTrend.

Caveats​

  • toLocaleString() output depends on the browser locale. For deterministic formatting in all locales, use formatter with an explicit Intl.NumberFormat locale.
  • There is no built-in precision option on type: 'number' — use formatter for decimal control.
  • decimalAlign is a currency renderer option, not a FieldConfig option for type: 'number'.

See Also​