Input OTP
Accessible one-time password input with copy-paste. Slots are size-8 to match the control scale. Built on the input-otp package.
Basic
Six slots with InputOTPSeparator between groups. Supports paste.
Installation
CLI
Also needs
npm i input-otp lucide-reactComposition
structure
Usage
input-otp.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| maxLength | number | — | Required. Number of characters / slots. |
| pattern | string | — | Regexp string — e.g. `REGEXP_ONLY_DIGITS` from `input-otp`. |
| value / onChange | string / (value) => void | — | Controlled value API. |
| disabled | boolean | false | Disables the underlying input. |
| index | number | — | Required on `InputOTPSlot` — zero-based slot index. |
| containerClassName | string | — | Classes for the OTP container flex row. |