Forms
OTP Field
Captures multi-slot one-time passwords and verification codes with keyboard and paste coordination.
Usage
Anatomy
The parts and how they nest, taken from the preview above.
Examples
Verify your account
Enter the code sent to your registered device.
Control sizes
Privacy and validation
Recommendations
| Guidance | Practice |
|---|---|
| Do | State the code length and delivery method. Allow paste and show verification errors near the field. |
Usage boundaries
| Guidance | Boundary |
|---|---|
| Scope | Completing the slots does not verify the code. Expiry, rate limits, and verification belong to the server. |
API reference
Public props from @mizen-labs/ui. Use exported prop types for the complete TypeScript contract.
| Prop | Type | Default | Description |
|---|---|---|---|
| | — | Number of characters and slots in the one-time code. |
| | — | Controlled string value across all input slots. |
| | — | Initial value for uncontrolled field presentation. |
| | — | Callback fired when the entered value changes. |
| | — | Callback fired when all slots are filled. |
| | "numeric" | Input validation mode applied to entered characters. |
| | false | Obscures entered characters for sensitive verification codes. |
| | "one-time-code" | Autocomplete attribute applied to the first slot and hidden input. |
| | false | Prevents user interaction across all slots. |
| | false | Presents slots in a non-editable readable state. |
| | false | Ensures a value is provided before submitting an enclosing form. |
| | — | Field name submitted with form data. |
| | "default" | Sets control dimensions across input slots and separators. |
| | "div" | Root container coordinating OTP state, keyboard navigation, and slot layout. |
| | "input" | Individual digit slot input handling typing, backspace, and navigation. |
| | "div" | Visual divider separating groups of input slots. |
| | — | Low-level Base UI OTP field primitive namespace. |