structyl

Number Field API

View component

The full prop reference for the Number Field component. A numeric input with stepper buttons and Intl formatting.

Import

tsx
import { NumberField } from '@structyl/styled';

Props

Root

Container component that manages number field state and provides context to child components

PropTypeDefault
asChild#boolean

Merge props with immediate child element instead of rendering a div

value#number | undefined

Controlled numeric value

defaultValue#number | undefined

Initial uncontrolled numeric value

onValueChange#(value: number | undefined) => void

Callback fired when the numeric value changes

min#number | undefined

Minimum allowed value; enforced on all value changes

max#number | undefined

Maximum allowed value; enforced on all value changes

step#number

Amount to increment/decrement with arrow keys or triggers

1
disabled#boolean | undefined

Disables input and trigger buttons

readOnly#boolean | undefined

Prevents editing but allows display; triggers remain functional

formatOptions#Intl.NumberFormatOptions | undefined

Options passed to Intl.NumberFormat for display formatting

locale#string | undefined

Locale string passed to Intl.NumberFormat for number formatting

className#string

CSS class name applied to the root div element

Input

Text input element with role='spinbutton'; forwards all standard HTML input props plus onChange/onKeyDown/onWheel event handlers

PropTypeDefault
className#string

CSS class name applied to the input element

onChange#(event: React.ChangeEvent<HTMLInputElement>) => void

Callback fired on input value change; composed with internal change handler

onKeyDown#(event: React.KeyboardEvent<HTMLInputElement>) => void

Callback fired on key down; composed with internal arrow/page/home/end key handlers

onWheel#(event: React.WheelEvent<HTMLInputElement>) => void

Callback fired on wheel scroll when focused; composed with internal increment/decrement handler

IncrementTrigger

Button to increase the numeric value by step amount; disabled when value >= max

PropTypeDefault
className#string

CSS class name applied to the button element

onClick#(event: React.MouseEvent<HTMLButtonElement>) => void

Callback fired on button click; composed with internal increment handler

DecrementTrigger

Button to decrease the numeric value by step amount; disabled when value <= min

PropTypeDefault
className#string

CSS class name applied to the button element

onClick#(event: React.MouseEvent<HTMLButtonElement>) => void

Callback fired on button click; composed with internal decrement handler

Source code

If you didn't find what you need here, read the component implementation .

structyl — Accessible React Component Library