Skip to content
Components

Input OTP

One-time-code field with grouped, focus-aware slots.

Composition

Custom digit groups

Pass length and separator to generate the slots automatically, or compose indexed slots as children.

  • <InputOTP>
    • first digit group
      • <InputOTPSlot />
    • <InputOTPSeparator />
    • remaining digits
      • <InputOTPSlot />
    </InputOTP>

Installation

The Control UI source installs this primitive from src/registry/sources/control-ui/ui/input-otp.tsx.

Registry command
See registry manifest

Raw code

Primary installed source

src/registry/sources/control-ui/ui/input-otp.tsx

Knobs

Typed custom properties the recipe paints with. Set one on the root — style, a utility class, or a skin — and every slot inherits it.

--cui-field-radius<length-percentage>var(--nest-radius, var(--radius-control))
--cui-field-background<color>var(--control-fill)
--cui-field-hover-background<color>var(--hover-fill)
--cui-field-affordance-background<color>transparent
--cui-field-affordance-shadow*0 0 transparent
--cui-field-affordance-foreground<color>var(--muted-foreground)
--cui-field-affordance-hover-background<color>var(--hover-fill)
--cui-field-foreground<color>var(--foreground)
--cui-field-border-color<color>var(--control-rim)
--cui-field-border-width<length>var(--control-rim-width)
--cui-field-shadow*var(--shadow-inset)
--cui-field-backdrop-filter*blur(0px)
--cui-field-height<length-percentage>var(--control-h-md)
--cui-field-padding-inline<length-percentage>var(--padding-x)
--cui-field-font-size<length-percentage>var(--text-body)