Input OTP

Accessible one-time password input with copy-paste support.

1
2
3
4
5
6

Installation

npx ghost-ui-native add input-otp

Usage

import { InputOTP, InputOTPGroup, InputOTPSlot } from '@/components/ui/input-otp';
<InputOTP maxLength={6} value={otp} onChange={setOtp}>
  <InputOTPGroup>
  {Array.from({ length: 6 }).map((_, i) => (
    <InputOTPSlot key={i} index={i} />
  ))}
  </InputOTPGroup>
</InputOTP>