Input OTP

Segmented PIN input with sketch slots.

–
<InputOTP maxLength={6} roughness={1.5}>
  <InputOTPGroup>
    <InputOTPSlot index={0} />
    <InputOTPSlot index={1} />
  </InputOTPGroup>
</InputOTP>

CLI install

npx doodleui-react add input-otp

Usage

import { InputOTP, InputOTPGroup, InputOTPSlot } from "doodleui-react";

<InputOTP maxLength={4}>\n  <InputOTPGroup>\n    <InputOTPSlot index={0} />\n    <InputOTPSlot index={1} />\n  </InputOTPGroup>\n</InputOTP>

Props

PropTypeDefaultNotes
maxLengthnumberrequiredNumber of OTP slots (input-otp).
animatebooleantrueDraw-in each slot; active slot uses accent stroke. Overrides DoodleUIProvider. Reduced motion disables this unless the provider set forceAnimate.
roughnessnumber1.5How wobbly the stroke is. 0 is almost geometric. 3+ is messy.
seednumberprovider / randomLocks the sketch. Omit to follow SketchSeedProvider (Shuffle) or a mount-time random seed.
sketchColorstring#1f1d1aStroke color. Also tints primary/accent fills where relevant.
classNamestringundefinedPassed through to the root element.
styleCSSPropertiesundefinedPassed through to the root element.