Draft. Ported from the shadcn-vue registry on 12 November 2026. Not yet approved. It is in the registry so teams can try it; the API may still change before approval.
A number field holds one number. People type it, or step it with the buttons or the arrow keys.
When to use
- For a count or an amount people often change by small steps, such as a quantity, a price or a number of retries.
- When the number has limits (
min,max) people should not cross.
When not to use
- For numbers that are really codes, such as a phone number, a postcode or an order ID. Use an input with
inputmode="numeric". - For a rough value in a range, where the exact number matters less. Use a Slider.
- For very large steps or many digits, where the buttons won’t help. Use an input.
Content
- Label it with the unit when the format doesn’t show it: “Timeout (seconds)”. Currency and percent come from
format-options. - Set
min,maxandstepso the buttons and keys never produce a value that will be refused. - For an error, say what to enter: “Enter 40 or less.”
Behaviour
- ↑ and ↓ step by
step, Page Up and Page Down by ten steps, Home and End go tominandmax. - A typed value is checked and formatted when the field loses focus or on Enter.
- A button turns grey and does nothing at its limit. The buttons are not in the tab order; the keys do the same job.
Tokens
| Part | Tokens |
|---|---|
| Field | size.control.default, radius.control, border.width.default, color.border.bold on color.surface, font.body.default, text centred |
| Focus | Edge color.border.focus with a 2 px inset ring of the same colour inside it |
| Invalid | color.border.danger |
| Disabled | color.background.disabled, color.border.disabled, color.text.disabled |
| Step buttons | size.target.minimum (24 px), radius.control.small, icon color.icon.subtle at size.icon.default; hover and pressed button.background.subtle.hover, .pressed; at a limit color.icon.disabled |
| Label gap | space.100 |