Talisman LogoTalisman Logo Design System
Browse documentation
Components

Input OTP double

A one-time code field with two groups of slots split by a dash, ready to use for six-digit verification codes.

Stableimport { InputOTPDouble } from "@repo/ui/input-otp-double";Source

When to use

  • To confirm a six-digit code from an authenticator app, SMS or e-mail.
  • When the default 3 + 3 layout is enough and you do not want to compose slots.

When not to use

  • A different layout, such as four digits in one group. Use Input OTP and compose the slots.
  • Free text or variable-length values. Use Input.

Examples

Empty

Partly filled

4
8
2
1

Disabled

4
8
2
1
9
3

Content

  • Label with the source of the code: “Código do autenticador”.
  • Add a description with the number of digits and where to find them.

Accessibility

  • Built on the input-otp library: a single real <input> receives the keystrokes and the slots only draw them.
  • Pass autoComplete="one-time-code" so mobile keyboards offer the SMS code.
  • Pass aria-label or link a visible Label: the component does not name the field.
  • Pass pattern={REGEXP_ONLY_DIGITS} to restrict input and open the numeric keyboard.
  • The active slot gets a focus border and ring. Slots are 36px.
  • The dash between the groups is aria-hidden.

Code

import { REGEXP_ONLY_DIGITS } from "input-otp";
import { InputOTPDouble } from "@repo/ui/input-otp-double";

<InputOTPDouble
  aria-label="Código do autenticador"
  autoComplete="one-time-code"
  onChange={setCode}
  pattern={REGEXP_ONLY_DIGITS}
  value={code}
/>;

Props

PropTypeDefaultDescription
disabledbooleanfalseDisables the whole field
maxLengthnumber6Total number of slots. The first three form the first group, the rest the second
onChange(value: string) => void—Called with the current code as the user types
patternstring—Regular expression every character must match
valuestring—Controlled code

Known issues

Issue Effect
The active slot uses ring-focus/50 and the dash uses text-primary/80. Translucent colors, which the repository avoids. The focus ring is weaker than the token.
The slots split at 3, so maxLength values other than 6 give uneven groups. A four-digit code renders as 3 + 1.
There is no error variant. An invalid code can only be signaled outside the field.
It duplicates InputOTP with a different slot style (36px, shadow-xs, rounded-md). The two OTP components look different side by side.
Edit this page on GitHub