- Docs
- Components
- Forms
OTP input
A one-time code in slots. Paste fills them all; the phone's SMS autofill lands in one go.
- Import
- @qeetrix/react/experimental
- Status
- ExperimentalSince 0.0.4
- Renders
<input> per slotServer-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Playground
Every prop, live, and the code it takes.
Groups
Size
Characters
import { Field } from "@qeetrix/react";
import { OTPInput } from "@qeetrix/react/experimental";
<Field label="Verification code">
<OTPInput />
</Field>02
Six digits
Typing moves on, Backspace moves back, paste fills every slot; SMS autofill lands in one go.
Sent to +91 98765 •••10.
<Field label="Verification code" description="Sent to +91 98765 •••10.">
<OTPInput onValueComplete={(code) => verify(code)} />
</Field>03
In groups
groups splits the slots: 123 – 456, easier to read back.
<Field label="Recovery code">
<OTPInput length={8} groups={[4, 4]} validationType="alphanumeric" />
</Field>04
Sizes
md in a console; lg on a sign-in page.
<Stack gap="lg">
<Field label="Code"><OTPInput size="md" /></Field>
<Field label="Code"><OTPInput size="lg" /></Field>
</Stack>05
Invalid
The Field's error, under the slots.
That code has expired. Send a new one.
<Field label="Verification code" error="That code has expired. Send a new one.">
<OTPInput defaultValue="482913" />
</Field>