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:
| Prop | Type | Default | Description |
|---|---|---|---|
| label | string | required | Input accessible name. |
| length | number | 6 | Digit count, clamped to 1–12. |
| value / defaultValue | string | empty | Code 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-inputMake 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.