Skip to main content

NumberField

A labelled numeric input with stepper keys and min/max clamping.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

A labelled numeric input with stepper keys and min/max clamping.

Accessibility​

Always render a visible <label> (the label prop wires htmlFor/id for you). Errors set aria-invalid and are announced via aria-describedby. Required fields expose aria-required.

Install and import​

npx shadcn@latest add @prism/number-field
import { NumberField } from '@/components/prism/NumberField';

In a no-build prototype, read it from the bundle instead: const { NumberField } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
labelstring—
descriptionstring—
valuenumber—
defaultValuenumber—
minnumber—
maxnumber—
stepnumber—
stepper"end" | "split"—"end" (default) stacks both keys on the trailing edge, so the pair reads as one control; "split" puts minus and plus either side of the field — only for wide numeric tables where the keys need separating.
isDisabledboolean—
onChange(value: number) =&gt; void—
idstring—
width"xs" | "sm" | "md" | "lg" | "full"—Maximum width: "xs" (8rem) | "sm" (12rem) | "md" (20rem) | "lg" (36rem) | "full" (default). A cap, not a fixed width — it still shrinks on a phone or in a narrow FormRow column; the label and messages follow it. Sizes are the --field-width-* tokens.
classNamestring—