- Accordion
- Alert Dialog
- Alert
- Autocomplete
- Avatar
- Badge
- Button Group
- Button
- Card
- Carousel
- Chart
- Checkbox
- Clipboard
- Collapsible
- Combobox
- Command
- Context Menu
- Date Picker
- Dialog
- Editable
- Field
- File Upload
- Floating Panel
- Hover Card
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- QR Code
- Radio Group
- Rating Group
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Spinner
- Splitter
- Steps
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle Group
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add @shark-ui/number-input
Usage
import { NumberField } from "@/components/ui/number-input";
<NumberField />
Sizes
Use the size prop to change the input height.
Small
Medium
Large
Examples
Disabled
Use the disabled prop to disable the number input.
Invalid
Use the invalid prop (or aria-invalid) to mark the number input as invalid and show error styling.
With Scrub
Render <NumberField /> with the scrubber prop and a label 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.
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
❌
API Reference
NumberField
| 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 |
For a complete list of props, see the Ark UI documentation.