Form Number Input

GitHub

Number input connected to Form context with server validation errors.

Installation

bash
pnpm dlx shadcn@latest add @cs/form-number-input

Usage

tsx
import { FormNumberInput } from "@/components/cs/form-number-input"
tsx
<FormNumberInput name="quantity" />

API Reference

FormNumberInput

Number input connected to Form context with server validation errors.

Props

NameTypeDefaultDescription
buttonOmit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> | undefined-Button displayed inside the input on the right.
defaultValuenumber | undefined-Initial numeric value for uncontrolled usage.
iconReactNode-Icon displayed inside the input on the left.
inputClassNamestring | undefined-Additional classes applied to the native input control.
labelReactNode-Field label and fallback placeholder.
name *string-Form field name used for submission and validation errors.
onValueChange((value: number | null) => void) | undefined-Called with the parsed number or null when the field is cleared.
orientation"vertical" | "horizontal" | "responsive" | null | undefined-Layout of the field label and input control.
valuenumber | undefined-Controlled numeric value.