- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/number-input.json
Usage
import { NumberField, NumberFieldGroup, NumberFieldInput, NumberFieldIncrement, NumberFieldDecrement } from "@/comopnents/ui/number-input";
<NumberField> <NumberFieldGroup> <NumberFieldInput /> <NumberFieldIncrement /> <NumberFieldDecrement /> </NumberFieldGroup> </NumberField>
Controlled
Use value and onValueChange to control the number input. Keep the value as a string when using formatOptions to preserve locale formatting.
Select the number 3
❌
Sizes
Use the size prop to change the input height.
Small
Medium
Large
State
Disabled
Use the disabled prop to disable the number input.
Invalid
Use the invalid prop to mark the number input as invalid.
Examples
Field Only
Render the input field without stepper buttons.
With Field
Use <Field />, <FieldLabel />, and <FieldDescription /> for a labeled number input with helper text.
Enter a value between 0 and 99
With Input Group
Use <InputGroup />, <InputGroupAddon />, and <InputGroupText /> to add prefix or suffix content like currency symbols or units.
With Scrub
Use the <NumberFieldScrubber /> to enable the scrubber interaction—drag the label to change the value.
With Range
Pass min and max to clamp the value. The input restricts the value to the specified range
Use clampValueOnBlur={false} to allow typing outside range until blur.
With Formatted Value
Use formatOptions with Intl.NumberFormatOptions to format the displayed value.
With Step
Use the step prop to set the increment/decrement amount.
Mouse Wheel
Use the allowMouseWheel prop to increment or decrement the value with the mouse wheel when the input is focused.
API Reference
NumberField
Root component. Manages numeric value and stepper controls.
| Prop | Type | Default |
|---|---|---|
size | sm | md | lg | md |
scrubber | boolean | false |
defaultValue | string | - |
value | string | - |
min | number | Number.MIN_SAFE_INTEGER |
max | number | Number.MAX_SAFE_INTEGER |
step | number | 1 |
formatOptions | Intl.NumberFormatOptions | - |
disabled | boolean | - |
invalid | boolean | - |
focusInputOnChange | boolean | true |
clampValueOnBlur | boolean | true |
allowMouseWheel | boolean | false |
onValueChange | (details: ValueChangeDetails) => void | - |
className | string | - |
NumberFieldGroup
Wraps the input and increment/decrement buttons.
| Prop | Type | Default |
|---|---|---|
className | string | - |
NumberFieldDecrement
Decreases the value by the step amount.
| Prop | Type | Default |
|---|---|---|
className | string | - |
NumberFieldIncrement
Increases the value by the step amount.
| Prop | Type | Default |
|---|---|---|
className | string | - |
NumberFieldInput
Numeric input. Accepts number or direct typing.
| Prop | Type | Default |
|---|---|---|
size | sm | md | lg | md |
className | string | - |
NumberFieldScrubber
Drag area for scrubbing the value (like slider). Wraps the input for label association.
| Prop | Type | Default |
|---|---|---|
children | ReactNode | - |
className | string | - |
For a complete list of props, see the Ark UI documentation.