Input OTP
A one-time password input component with individual character slots for verification codes.
uiclass-variance-authorityinput-otplucide-react
Installation
$npx futureuikit add input-otp
Import
import { InputOTP } from "@/components/ui/input-otp"
Layout Variant
Color Theme
Theme
Shape
Spacing
Digits
Named Keys & Props
Pass these exact named keys as props on <InputOTP />. Click any color pill to copy the prop.
colorDefault is "default"(Black & White)variantVisual style"solid""outline""ghost""link"themeSurface theme"default""modern""clean""futuristic""brutal""halftone"shapeCorner shape"default""square""rounded""sharp"spacingInner spacing"default""2x""4x""6x""8x"Usage Example
A basic implementation example to get you started.
Example Implementation
import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from "@/components/ui/input-otp";
export default function Example() {
return (
<InputOTP maxLength={6}>
<InputOTPGroup>
<InputOTPSlot index={0} />
<InputOTPSlot index={1} />
<InputOTPSlot index={2} />
</InputOTPGroup>
<InputOTPSeparator />
<InputOTPGroup>
<InputOTPSlot index={3} />
<InputOTPSlot index={4} />
<InputOTPSlot index={5} />
</InputOTPGroup>
</InputOTP>
);
}Features
Key capabilities and highlights.
Key Capabilities
- ◆Renders individual slots for each OTP digit.
- ◆Supports grouping and separators for visual clarity.
- ◆Handles paste, backspace, and auto-advance between slots.
Notes
Important implementation details to consider.
Implementation Details
- ◆Install: Run 'npx futureuikit add input-otp'.
- ◆Import: 'import { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from "@/components/ui/input-otp";'
- ◆Usage: Compose groups of OTP slots with optional separators for verification forms.