PIN Input

Selection & Input
Local guide ↗ import { PinInput } from "bits-ui"

Six-digit OTP

Numeric input, sanitizing paste and an observable completion callback share one invisible native input

Paste “482-901” or type six digits.

0 of 6 digits entered

Form submission

The visual cells submit through the named native input rather than concatenating six separate fields

Enter the four-digit code from your authenticator.

The root owns one string value and its children snippet supplies a cells array. Each cell reports char, isActive and hasFakeCaret; pass that object unchanged to PinInput.Cell. A pattern rejects invalid input, while pasteTransformer must return the sanitized text Bits UI should actually store.

The cells are presentation around an invisible native input. Set name to include its string value in form data, inputId to connect a label to that real input, and bind inputRef when imperative focus or selection access is needed. onComplete fires when maxlength cells are filled.