This page as markdown: /number-field.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

NumberField

Status: stable

Numeric input with decrement/increment steppers over Base UI NumberField — keyboard arrows, scroll, scrub-to-change, min/max clamping, locale formatting, and form integration. Styled like Input; drops straight into a Field.

Keywords: number field, numeric input, stepper, form

Usage

Use NumberField for numeric values that benefit from validation, min/max bounds, or step controls.

Best practices

Props

Name Type Default Description
min number — Lower bound. Clamps typing, arrows, scroll and scrub alike, so the value cannot leave the range by any route.
max number — Upper bound, clamped on every input route the same way as min.
value / defaultValue number — Controlled / uncontrolled numeric value.
onValueChange (value: number | null, event) => void — Fired when the value changes (null when cleared).
step / smallStep / largeStep number — Increment amount; smallStep applies with the meta key, largeStep with shift.
format Intl.NumberFormatOptions — Locale formatting (currency, percent, units, …).
steppers boolean true Show the decrement / increment buttons. Turn off in a dense property grid — the two 32px stepper buttons (36px with their inset) put a ~110px floor on the control; without them the value left-aligns.
size "md" | "sm" | "xs" "md" The field ladder shared with Input, SelectTrigger, ComboboxInput, SearchInput and DatePicker: md is the form field, sm the toolbar field one rung down (--control-sm) beside sm buttons and an sm Select, xs the inset tool-panel field. The steppers step down with it.
decrementLabel string "Decrease" Accessible name of the decrement stepper. Translate it with the rest of the form.
incrementLabel string "Increase" Accessible name of the increment stepper.
disabled / readOnly / required / name / id — — Standard form-control props. Base UI applies id + required to the input, so it labels and validates correctly.

Variants

Tokens used

field-border, field, foreground, muted-foreground, accent, accent-foreground, ring

Accessibility

Related

Examples

Bounded

import { NumberField } from "@sableui/react"

<NumberField defaultValue={1} min={0} max={99} />

In a field

import { Field, NumberField } from "@sableui/react"

<Field label="Quantity"><NumberField min={1} defaultValue={1} /></Field>

Currency

import { NumberField } from "@sableui/react"

<NumberField defaultValue={9.99} format={{ style: "currency", currency: "USD" }} />