NumberField
A labelled numeric input with stepper keys and min/max clamping.
Signature
Density
Viewport
Theme and light/dark are set in the top barWhen 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
| Prop | Type | Required | Description |
|---|---|---|---|
label | string | — | |
description | string | — | |
value | number | — | |
defaultValue | number | — | |
min | number | — | |
max | number | — | |
step | number | — | |
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. |
isDisabled | boolean | — | |
onChange | (value: number) => void | — | |
id | string | — | |
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. |
className | string | — |