Form Number Input
GitHubNumber input connected to Form context with server validation errors.
Installation
bash
pnpm dlx shadcn@latest add @cs/form-number-inputUsage
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
| Name | Type | Default | Description |
|---|---|---|---|
| button | Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> | undefined | - | Button displayed inside the input on the right. |
| defaultValue | number | undefined | - | Initial numeric value for uncontrolled usage. |
| icon | ReactNode | - | Icon displayed inside the input on the left. |
| inputClassName | string | undefined | - | Additional classes applied to the native input control. |
| label | ReactNode | - | 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. |
| value | number | undefined | - | Controlled numeric value. |