OTP Input

A 352px row of five or six square cells for a one-time code. Typing moves on, Backspace moves back, and pasting a code fills every cell.

FreeReact and Vue

This is a hint text to help user.

Type, or paste a whole code into any cell.

Add an empty Orvain OTP Input with 6 cells, square corners, no shadow.

Orvain MCPIncluded with the library

When to use#

  • For verification codes sent by email or text, usually six digits.
  • When the code has a fixed, known length, so the cells show how much is left.

When not to use

  • Use an Input for passwords or codes of unknown length.

Anatomy#

1Cells

52px squares, 8px apart, radius 12 (fully round when Pill), a 1px #e1e1e1 stroke inside.

2Digit

Satoshi Bold 14, centred.

3Cursor

The active cell takes a near-black stroke and a blinking caret.

4Hint

10px below the row: where the code was sent, or why it failed.

States#

Default

Empty cells, the first ready for input.

Valid Fields

Every cell filled.

Empty + Error, Filled + Error

Red strokes and a red hint.

Read Only

The code shows but cannot change.

All Fields Disabled

Grey and inert, while checking or after too many tries.

Source#

The OTP Input ships in the free packages, @orvain/react and @orvain/vue, and in the Figma library with every variant and state shown above. The code on this page is the code you install.

Install the packages

Used in these blocks