Components
HeroUI v3 NumberField — numeric input with steppers, min/max, step values, format options, validation, variants and form usage.
npx shadcn@latest add https://21st.dev/r/hero_ui/heroui-number-fieldLoading preview...
import { Description, Label } from "@heroui/react"
import { NumberField } from "@/components/ui/heroui-number-field"
export function WithDescription() {
return (
<div className="flex w-full max-w-64 flex-col gap-4">
<NumberField defaultValue={1024} minValue={0} name="width">
<Label>Width</Label>
<NumberField.Group>
<NumberField.DecrementButton />
<NumberField.Input className="w-[120px]" />
<NumberField.IncrementButton />
</NumberField.Group>
<Description>Enter the width in pixels</Description>
</NumberField>
<NumberField
defaultValue={0.5}
formatOptions={{ style: "percent" }}
maxValue={1}
minValue={0}
name="percentage"
step={0.1}
>
<Label>Percentage</Label>
<NumberField.Group>
<NumberField.DecrementButton />
<NumberField.Input className="w-[120px]" />
<NumberField.IncrementButton />
</NumberField.Group>
<Description>Value must be between 0 and 100</Description>
</NumberField>
</div>
)
}
export default WithDescription
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...
Loading preview...