Skip to content

Number field

A number typed or stepped, formatted and parsed in the locale. Use formatOptions for currency, percentages and units.

Language
Appearance

Bounded steps

How many times the agent calls back.
import { NumberField } from '@arbol-ai/ui';

<NumberField
  className="max-w-48"
  defaultValue={2}
  description="How many times the agent calls back."
  label="Call attempts"
  maxValue={5}
  minValue={1}
/>

Currency, percent and units

import { NumberField } from '@arbol-ai/ui';

<div className="grid max-w-48 gap-4">
  <NumberField
    defaultValue={85_000}
    formatOptions={{ currency: 'COP', maximumFractionDigits: 0, style: 'currency' }}
    label="Consultation price"
  />
  <NumberField
    defaultValue={0.15}
    formatOptions={{ style: 'percent' }}
    label="Discount"
    maxValue={1}
    minValue={0}
    step={0.05}
  />
  <NumberField
    defaultValue={24}
    formatOptions={{ style: 'unit', unit: 'hour', unitDisplay: 'long' }}
    label="Reminder lead time"
    minValue={1}
  />
</div>

Source

The examples above are src/components/number-field/number-field.examples.tsx, which the library’s tests render too.

Type to search…

↑↓ navigate↵ selectEsc close