Component libraryNumber input
Number input
ProA numeric field with increment and decrement controls.
npx shadcn@latest add @tidal-pro/number-stepperInstallation
Pro source is gated. Configure the @tidal-pro registry using the agent guide. Create an access key from your account after purchasing.
Terminal
Import components/ui/tidal.css, components/ui/number-stepper.css, then add the component inside a tidal-scope wrapper. Its scoped design tokens keep it independent of your existing CSS.
Usage
Complete example source · Dependency and asset manifest
Loading the complete example…
API & behavior
Required visible label, controlled value:number|null and onValueChange(number|null); initialize with useState<number|null>(initialValue). A real type=number input retains native ref/name/required/disabled/readOnly/form/typing/validation, native onInput/onChange/focus/blur/invalid handlers, and unmodified ArrowUp/Down/Home/End/Enter behavior. null represents empty; nonfinite caller values render empty and invalid without mutating caller state. Optional finite min/max; nonfinite bounds are omitted. step(default1) must be positive/finite or falls back1. Reversed finite bounds disable the field/controls and expose linked configuration feedback. Native min/max/step validity is reflected in aria-invalid after hydration and user edits; consumer error also links an alert. Pointer/Enter/Space step buttons use a detached native input probe for precise decimal step-grid and boundary behavior; only onValueChange is called for button steps, without forging native change events or mutating the real input. Actual native step availability includes a maximum that is off the step grid. Boundary buttons remain focusable with aria-disabled and make no change; disabled/readOnly disables both. PageUp/Down and Shift+ArrowUp/Down step ten increments, compose with native onKeyDown and honor preventDefault/modifier keys and composition guards. No wheel override, hold-to-repeat or label scrubbing is introduced. Optional unit, formatValue(number), localizable decreaseLabel/increaseLabel, description/error, className(input) and rootClassName. Native typing is shown while focused; an aria-hidden tabular digit display rolls while unfocused, with a readable truncated fallback for long formatted values. Full formatted value/unit is exposed through aria-valuetext, and help/error IDs merge with caller aria-describedby; empty values describe the unit once, and numeric values include it only in aria-valuetext. Consumer native onChange only receives actual input changes; use onValueChange for all numeric updates. Native editing may temporarily produce null/badInput or out-of-range/off-step numbers; the consumer owns validation and submission. Reduced motion resolves digit, feedback and press states immediately. No wrapper form, network work, storage or booking is introduced.
Style with the --t-* CSS variables. Set data-theme="dark" on your tidal-scope wrapper for a dark surface. Motion respects the system’s reduced-motion preference.