OTP Field
A segmented one-time-password input with paste and keyboard support.
A segmented one-time-password input with paste and keyboard support.
Backed by Base UI OTP Field for upstream behavior and configuration. Zenos owns the public API, styling, and composition shown on this page.
import { OTPField } from "@zentara-co/zenos-ui";Variants
Section titled “Variants”Each slot uses the same surfaces as Input: default (standard), filled (subtle), and none (borderless). Set variant on the root or on individual OTPField.Input nodes when composing groups.
States
Section titled “States”The root forwards disabled, required, and Field invalid semantics to every slot. Invalid styling matches Input.
The verification code has expired.
Length and grouping
Section titled “Length and grouping”Use the shorthand root when every slot is identical. Compose Group, Input, and Separator when the code has meaningful sections.
Controlled value
Section titled “Controlled value”0 of 6 characters entered.
Variants
defaultfillednone OTPField.Root OTPField.Input OTPField.Group OTPField.Separator
API
| Prop | Type | Default | Description |
|---|---|---|---|
value | string | — | Controlled OTP value. |
defaultValue | string | — | Initial uncontrolled value. |
onValueChange | (value: string) => void | — | Runs when digits change. |
length | number | — | Number of generated inputs. |
disabled | boolean | false | Disables entry. |
required | boolean | false | Marks the code as required. |
variant | default | filled | none | default | Surface treatment per slot (`default` = standard, `filled` = subtle, `none` = borderless). |
Unless narrowed above, each DOM-rendering part also accepts its underlying native or Base UI props,
including className, style, aria-*, and data-*.
Accessibility
Section titled “Accessibility”OTPField preserves Base UI paste, focus, and keyboard behavior. Label the root through Field, set the expected length, and avoid implementing per-slot focus movement yourself. Separators are presentation-only and are hidden from assistive technology.