Form OTP Input
GitHubOne-time password input connected to Form context with server validation errors.
Installation
bash
pnpm dlx shadcn@latest add @cs/form-otp-inputUsage
tsx
import { FormOtpInput } from "@/components/cs/form-otp-input"tsx
<FormOtpInput name="code" maxLength={6} />API Reference
FormOtpInput
One-time password input connected to Form context with server validation errors.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | - | Custom slots rendered inside the OTP input group. |
| containerClassName | string | undefined | - | Additional classes applied to the OTP slot container. |
| defaultValue | string | - | Initial OTP value used before the field is changed. |
| inputClassName | string | undefined | - | Additional classes applied to the OTP input control. |
| label | string | undefined | - | Field label and fallback placeholder. |
| name * | string | - | Form field name used for submission and validation errors. |
| pattern | string | undefined | - | You can also use REGEXP_ONLY_CHARS, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS |