Inputs and selection
OTP input
N-digit code, paste-aware
function OtpInputDemo() { const [code, setCode] = React.useState(''); return <OtpInput value={code} onChange={setCode} autoFocus={false} error={code.length === 6 && code !== '123456' ? 'That code is not right' : undefined} />;}Usage
Try 123456. Handles paste and backspace across cells.
API
<OtpInput length value onChange onComplete error? />Get it
Already in every copy of the native kit:
import { OtpInput } from '@/components/kit/otp-input';Details
- Exports
OtpInput- Installs with
- @halftone-native/lib-utils, @halftone-native/text
- Also searched as
- code, verification, pin, 2fa, passcode
- Registry JSON
- /r/native/otp-input.json
function OtpDemo() { const [code, setCode] = React.useState(''); const wrong = code.length === 6 && code !== '123456'; return <OtpInput className="w-full max-w-sm" value={code} onChange={setCode} onComplete={(c) => (c === '123456' ? toast.success('Code accepted') : null)} error={wrong ? 'That code didn’t match. Try 123456.' : undefined} />;}Usage
Try 123456. Handles paste and backspace across cells.
API
<OtpInput length value onChange onComplete error? />Get it
Already in every copy of the web kit:
import { OtpInput } from '@/components/kit/otp-input';Details
- Exports
OtpInput- Packages
- cn@^0.5.2
- Also searched as
- one-time code, verification code, pin
- Registry JSON
- /r/web/otp-input.json
Agents: the whole registry is at /llms.txt.