Input OTP

An input for entering one-time passcodes, split across individual character slots.

$bunx shadcn@latest add @nx-ui/input-otp
Registry item
Installs withutils

Controlled, six digits

Drive `value` and `onChange` yourself. Useful for gating a submit action or mirroring the code elsewhere on the page.

0 of 6 digits entered

Grouped slots

Split slots into groups with InputOTPSeparator for longer codes, such as a six-digit site access PIN.

States

Disabled blocks entry entirely; aria-invalid on the group draws the destructive ring for a failed verification.

4
8
2
1
1
9

Composition: verify site access code

An OTP field wired into a Field/FieldLabel layout, confirming a haulier's one-time code before releasing a gate PIN for Hartfield Composting Site.

We've texted a 6-digit code to the driver on file for this movement. Enter it to unlock the Hartfield gate PIN.

API reference

Exported parts and their props, extracted from the component source.