Knit UI
GitHub

Playground

Loading playground…

false
true
Playground
<NumberFormatter
  value={1234567.89}
  thousandSeparator
  decimalScale={2}
  fixedDecimalScale={false}
  prefix=""
  suffix=""
  thousandsGroupStyle="thousand"
  allowNegative
  decimalSeparator="."
/>

Examples

Currency Display

Currency prefix and suffix with two fixed decimal places.

Loading example…

Currency DisplaySourceStorybook

Fixed Decimal Scale

Fixed decimal scale pads trailing zeros so the decimal column always aligns.

Loading example…

Fixed Decimal ScaleSourceStorybook

Thousands Group Styles

Different thousands grouping styles — standard, Indian lakh, and CJK wan.

Loading example…

Thousands Group StylesSourceStorybook

Negative Values

Negative values — with and without the allowNegative guard.

Loading example…

Negative ValuesSourceStorybook

Custom Separators

Custom decimal and thousands separator characters for locale-specific formatting.

Loading example…

Custom SeparatorsSourceStorybook

Edge Cases

Edge cases: empty value, non-finite input, and zero.

Loading example…

Edge CasesSourceStorybook

Props

PropTypeDefaultDescription
allowNegativeboolean | undefinedtrueWhen false, the absolute value is shown for negative inputs.
decimalScalenumber | undefinedInfinityMaximum digits after the decimal point.
decimalSeparatorstring | undefined'.'Character used as the decimal separator.
disabled systemboolean | undefinedSpecifies the disabled state of the text view for testing purposes.
fixedDecimalScaleboolean | undefinedfalsePad trailing zeros so the decimal part always has `decimalScale` digits.
prefixstring | undefinedString prepended to the formatted value (e.g. currency symbol).
size system"xs" | "sm" | "md" | "lg" | "xl" | "xxs" | "xxl" | undefined
suffixstring | undefinedString appended to the formatted value (e.g. unit label).
theme systemThemeName | null | undefinedApplies a theme to this element
thousandSeparatorstring | boolean | undefinedtrueCharacter used to separate thousands groups. `true` uses a comma.
thousandsGroupStyle"none" | "thousand" | "lakh" | "wan" | undefined
thousand · lakh · wan · none
'none'Grouping strategy: standard (3), Indian lakh (2/3), CJK wan (4), or none.
valuestring | number | undefined1234567.89The numeric value to format.
Accessibility & DOM props (2)
PropType
keyKey | null | undefined
refRef<TamaguiTextElement> | undefined

Plus 507 inherited style props from Box — the full Tamagui/React Native style surface, including token shorthands like p, mx, bg and c. See Tokens for the scales they accept, or the full list.