Skip to Content
Forms & Inputs@hacline/ui/otp-input

OTPInput

Handle segmented one-time passcodes inside a single native field.

Usage

Omit children to automatically generate slots from maxLength and optional groups (for example, groups={[3, 3]} inserts a separator between two 3-digit groups).

Enter 6 digits

Alphanumeric Invite Code

Set pattern="alphanumeric" and maxLength={4} to accept both letters and digits across four slots backed by one native field.

Variants, Sizes & Masking

Switch slot styling with variant ("default" / "filled" / "connected"), adjust slot dimensions with size ("sm" / "md" / "lg"), and hide sensitive PIN digits with mask.

Connected (3-3)
Filled + Masked PIN
Compact (small)

Parts

Pass custom children when you need full layout control.

PartDescription
OTPInputGroup
Lays out a run of slots.
OTPInputSeparator
Drawn between groups, like a dash.
OTPInputSlot
One character of the code. Without children, it shows the character.

Props

Prop

Type

View UI SDK parts and state attributes.