Skip to content

    Browse components

    Input OTP

    One-time-code field: slots that pop each digit in, a blinking caret, paste and SMS autofill, a wave on completion and a shake on error.

    Open
    Customize
    numeric
    alphanumeric

    Installation

    npx shadcn@latest add @glint-ui/input-otp

    First time using @glint-ui? Add the registry to components.json once, or install by URL: npx shadcn@latest add https://glintui.vercel.app/r/input-otp.json

    Usage

    import { InputOtp } from "@/components/ui/input-otp";
    
    <InputOTP length={6} onComplete={(code) => verify(code)} />

    Props

    PropTypeDefaultDescription
    lengthnumber6Number of slots.
    groupSizenumber3Separator after every N slots (0 = none).
    allow"numeric" | "alphanumeric""numeric"Accepted characters; others are dropped, including from pasted text.
    invalidbooleanfalseError look with a shake.
    disabledbooleanfalseDisable the field.
    valueReactNode—Controlled value (with onChange).
    onCompleteReactNode—Called with the code once every slot is filled.
    classNamestring—Extra classes for the root element.