OTP Input
OtpInput takes a one-time code or a PIN. Type six digits, or paste them:
6 characters
Waiting for 6 digits
import { Paragraph, View } from '@hozo/core'import { OtpInput } from '@hozo/ui'import { useState } from 'react'
export function OtpInputDemo() { const [code, setCode] = useState('') const [sent, setSent] = useState<string>() return ( <View className="items-start gap-3"> <OtpInput accessibilityLabel="Verification code" value={code} onChange={setCode} onComplete={setSent} /> <Paragraph className="text-sm text-hozo-text-body"> {sent ? `Checking ${sent}` : 'Waiting for 6 digits'} </Paragraph> </View> )}- One field, not six. The cells are drawn over a single input, which is what a screen reader hears (“Verification code, 6 characters”) and what the operating system fills when it offers a code from a text message. A paste of the whole code lands at once.
valueandonChangehold the code as a string.onCompleteis called once it is full.lengthis 6 by default.typeisnumber, which brings up a number pad, ortext.maskhides the characters, for a PIN.accessibilityLabelnames the field.