docs/components/number-input
Sections
Components
Utilities
Forms
Hooks
Copy Markdown
Numeric input for entering values.
PreviewCode
CLIManual
pnpmbunnpmyarn
pnpm dlx shadcn@latest add @shark/number-input
NumberInput
└── NumberInputGroup
├── NumberInputDecrement
├── NumberInputInput
├── NumberInputIncrement
└── NumberInputScrubber
import {
NumberInput,
NumberInputGroup,
NumberInputInput,
NumberInputIncrement,
NumberInputDecrement
} from "@/comopnents/ui/number-input";
<NumberInput>
<NumberInputGroup>
<NumberInputInput />
<NumberInputIncrement />
<NumberInputDecrement />
</NumberInputGroup>
</NumberInput>
Use value and onValueChange to control the number input. Keep the value as a string when using formatOptions to preserve locale formatting.
PreviewCode
Select the number 3
❌
Use the disabled prop to disable the number input.
PreviewCode
Use the invalid prop to mark the number input as invalid.
PreviewCode
Use the size prop to change the input height.
PreviewCode
PreviewCode
PreviewCode
PreviewCode
Use Field components for a labeled number input with helper text.
PreviewCode
Quantity
0 - 100 only
Use InputGroup, InputGroupAddon, and InputGroupText to add prefix or suffix.
PreviewCode
€
EUR
Use the NumberInputScrubber to drag the label to change the value.
PreviewCode
Quantity
Pass min and max to restrict the value to the specified range.
Use clampValueOnBlur={false} to allow typing outside range until blur.
PreviewCode
Use formatOptions with Intl.NumberFormatOptions to format the displayed value.
PreviewCode
Use the step prop to set the increment/decrement amount.
PreviewCode
Step 5
Step 0.1
Use the allowMouseWheel prop to increment or decrement the value with the mouse wheel.
PreviewCode
Root component. Manages numeric value and stepper controls.
| Prop | Type | Default |
|---|---|---|
size | `"sm" | "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 | - |
asChild | boolean | false |
Wraps the input and increment/decrement buttons.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Decreases the value by the step amount.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Increases the value by the step amount.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
Numeric input. Accepts number or direct typing.
| Prop | Type | Default |
|---|---|---|
size | `"sm" | "md" |
className | string | - |
asChild | boolean | false |
Drag area for scrubbing the value.
| Prop | Type | Default |
|---|---|---|
className | string | - |
asChild | boolean | false |
For a complete list of props, see the Ark UI documentation.
[
Previous page
Native Select ](/docs/components/native-select)[
Next page
Pagination ](/docs/components/pagination)
On This Page
InstallationAnatomyUsageControlledStatesDisabledInvalidSizesSmallMediumLargeExamplesField OnlyWith FieldWith Input GroupWith ScrubWith RangeWith Formatted ValueWith StepMouse WheelAPI ReferenceNumberInputNumberInputGroupNumberInputDecrementNumberInputIncrementNumberInputInputNumberInputScrubber