This component requires the FyskProvider. See Quick Start →
Preview
OTPInput
TypeScript
Installation
bash
bash
Usage
tsx
tsx
Examples
Default
Individual boxed inputs for each character.
Component
TypeScript
Variants
Includes condensed (grouped group) and underline styles.
Component
TypeScript
Default
Condensed
-
Underline
Features
Automatic Focus: Seamlessly moves to the next field as the user types and moves back on backspace.
Paste Support: Handles pasting whole verification codes, splitting them across the appropriate fields.
Validation: Support for
numeric,alpha, andalphanumericrestriction modes.Visual Feedback: Built-in state handling for
error,success, andloading(pulse) feedback.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
length | number | 6 | Number of OTP digits/characters. |
variant | "default" | "condensed" | "underline" | "default" | Visual style of the input boxes. |
size | "default" | "xs" | "sm" | "md" | "lg" | "xl" | "default" | The visual size of each OTP input. |
state | "idle" | "loading" | "success" | "error" | "idle" | Current validation or submission state. |
inputType | "numeric" | "alphanumeric" | "alpha" | "numeric" | Type of characters allowed. |
onChange | (value: string) => void | - | Callback returning the full code string. |
Icon | React.ReactNode | - | Custom separator icon for the condensed variant. |
Accepts all standard HTML input attributes.