InputOTP

Storybook

A segmented code input for OTP codes, PINs, and verification tokens. Each character gets its own visual slot with blinking caret animation.

Default

6-digit OTP with two groups of 3, separated by a dash. Type digits to fill slots left-to-right.

4-Digit PIN

A simple 4-digit PIN input in a single group.

Alphanumeric

Accepts letters and digits with pattern="alphanumeric".

Custom Pattern (Hex)

8-character hex code with pattern="[a-fA-F0-9]". Try typing "g" — rejected. Type "a" or "f" — accepted.

With Separators

3 groups of 2 with separators between each group.

Disabled

Pre-filled and disabled. Slots show the value but input is not focusable.

Hybrid

Client instant + server notification via on_value_change and on_complete.

Event log:
(none)

Server-controlled

Server owns the value via the value assign. Buttons set the value from the server. Typing notifies but doesn't update locally.

Server state: value=123

Form Integration

Inside a <.form> using form_field with type="input_otp".

Enter the 6-digit code sent to your phone.