Components
A NumberField allows users to enter a number, and increment or decrement the value using stepper buttons or the keyboard. Number fields can be built with <input type="number">, but the behavior is very inconsistent across browsers and platforms, it supports limited localized formatting options, and it is challenging to style the stepper buttons. NumberField helps achieve accessible number fields that support internationalized formatting options and can be styled as needed.
npx shadcn@latest add https://21st.dev/r/jolbol1/numberfieldLoading preview...
import { FieldGroup, Label } from "@/components/ui/field"
import {
NumberField,
NumberFieldInput,
NumberFieldSteppers,
} from "@/components/ui/numberfield"
export function NumberFieldDemo() {
return (
<NumberField defaultValue={1024} minValue={0}>
<Label>Width</Label>
<FieldGroup>
<NumberFieldInput />
<NumberFieldSteppers />
</FieldGroup>
</NumberField>
)
}