Components
Number Input
A number field with steppers, an optional unit and keyboard stepping.
Ombelle · light
Number Input
Installation
Run in a project initialized with an Ombelle preset (see Get started). The component uses the saved project preset. Run the command from your app folder; it shows the changes and asks before writing.
pnpm dlx @ombelle-ui/cli@1.1.2 add number-inputAdds components/ui/number-input.tsx and installs react, clsx, tailwind-merge, lucide-react with lifecycle scripts disabled. This is a client component.
In a liquid glass project the plan adds a notice that accessibility is not guaranteed, because text contrast depends on the background behind the glass.
Usage
example.tsx
import { NumberInput } from '@/components/ui/number-input'
export function Example(){return <div style={{ display: "grid", gap: "0.5rem" }}><label htmlFor="radius">Border radius</label><NumberInput id="radius" name="radius" defaultValue={12} min={0} max={32} unit="px" onValueChange={(value, { valid }) => console.log(value, valid)} /></div>}API and states
- API
- NumberInput (value, defaultValue, text, onValueChange(value, { text, valid }), min, max, step, largeStep, unit, decrementLabel, incrementLabel)
- Minimum states
- Value, empty, invalid, at a bound, disabled, focus
- Native basis
- Native text input with role spinbutton, one template for both editions
- Styles
- Stable in Ombelle, Papier, Organic, Retro futurism, minimalist, neo-brutalism and flat, light and dark. Liquid glass: stable, accessibility not guaranteed.