- Docs
- Components
- Input OTP
Input OTP
Accessible one-time password component with copy paste functionality.
Preview
Code
Installation
CLI
Manual
Anatomy
Single import
Multiple imports
Examples
Pattern
Use the pattern prop to define a custom pattern for the OTP input.
Preview
Code
Separator
You can use the <InputOTPSeparator /> component to add a separator between the input groups.
Preview
Code
Controlled
You can use the value and onChange props to control the input value.
Preview
Code
Form
Component input-otp-form-demo not found in registry.
API Reference
InputOTP.Root
| Prop | Type | Default |
|---|---|---|
maxLength | number | |
value | string | |
onChange | function | |
pattern | RegExp | |
disabled | boolean | |
autoFocus | boolean | |
containerClassName | string |
InputOTP.Group
| Prop | Type | Default |
|---|---|---|
children | ReactNode | |
className | string |
InputOTP.Slot
| Prop | Type | Default |
|---|---|---|
index | number | |
className | string |
InputOTP.Separator
| Prop | Type | Default |
|---|---|---|
className | string |