sigilUI

Input OTP

Enter a one-time code in individual character slots.

@sigil-ui/componentsReact

Preview

Live preview Interactive

Import

import { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from "@sigil-ui/components";

Usage

<div className="grid gap-[var(--s-space-12)]">
    <label htmlFor="verification-code">Verification code</label>
    <InputOTP id="verification-code" length={6}>
    <InputOTPGroup>{Array.from({ length: 6 }, (_, i) => <InputOTPSlot key={i} aria-label={i === 0 ? undefined : `Digit ${i + 1}`} />)}</InputOTPGroup>
  </InputOTP>
  </div>

Sub-components

This component includes the following parts:

  • <InputOTPGroup>
  • <InputOTPSlot>
  • <InputOTPSeparator>

Token integration

CSS VariablePurpose
--s-borderBorder
--s-textText
--s-duration-fastDuration fast
--s-radius-mdRadius md
--s-ringRing
--s-primaryPrimary
--s-text-mutedText muted