Team seats
$36 per month
Installation
$ pnpm dlx shadcn@latest add @synccn/number-inputFirst time in this project? Connect synccn with one command.
Usage
import { NumberInput } from "@/components/ui/number-input";<NumberInput min={1} max={50} />API reference
Generated from the component's TypeScript types, so it always matches the code.
NumberInput
Stepper input. Hold a button to repeat; arrow keys and scroll-free typing work too.
PropTypeDescription
- value
numberControlled value.
- defaultValue
numberDefault
0Initial value when uncontrolled.
- onValueChange
(value: number) => voidCalled with the new value.
- min
numberDefault
-InfinityLowest value.
- max
numberDefault
InfinityHighest value.
- step
numberDefault
1Amount per step.
- format
(value: number) => stringFormats the displayed value.
- aria-label
stringAccessible name for the field.
- className
stringExtra classes for the root element.
Dependencies
Read from the component's imports when the site builds. The CLI installs all of these for you.
npm packages
- clsx for cn()
- tailwind-merge for cn()
- lucide-react for Minus, Plus
Keyboard
- ↑or↓Increase or decrease by one step
Accessibility
- Holding the + or − button repeats, speeding up the longer it's held.
From the source
Read from this component's code when the site builds, so it can't drift.
- ARIA attributes: aria-label
- Keys handled: ArrowUp, ArrowDown, Enter
More inputs
ButtonSeven variants, four sizes and a built-in loading state.InputText field with optional leading icon and invalid state.TextareaMulti-line field that grows with its content and counts characters.CheckboxChecked, unchecked and indeterminate, with label and description.SwitchToggle with a springy thumb in three sizes.Radio GroupPick one option, shown as dots or as selectable cards.