v0.3.1 StableFoundation ComponentReact 18 & 19Zero Runtime CSS

OTPInput

One-time codes without six separate focus stops.

Interactive preview

Usage

import { OTPInput } from "@devvy-ui/react";

<OTPInput label="Verification code" name="code" length={6} required />

API reference

Native HTML attributes, className, style and a forwarded ref are supported. Component-specific props:

PropTypeDefaultDescription
labelstringrequiredInput accessible name.
lengthnumber6Digit count, clamped to 1–12.
value / defaultValuestringemptyCode text.
onComplete(code: string) => void—Called when a changed code reaches the requested length.

Accessibility & behavior

Platform Behavior & Guidelines

One native input supports one-time-code autofill, numeric keyboards, digit normalization and formatted paste. The component never verifies a code against a server.

Source ownership

Run npx @devvy-ui/cli init once in your React project, then add the source:

npx @devvy-ui/cli add otp-input

Make the source yours.

Start from the canonical implementation used by the package and registry. Change the code, keep the MIT notice, and build the behavior your project needs.

OTPInput.tsxREACT / TSX

Edit your own copy. Downloaded source uses your changes; the component preview above uses the shipped version. Run the source installer first to include shared helpers.