Skip to main content
Urbicon UI

PinInputbeta

Segmented one-time-code / PIN entry — a row of single-character cells with auto-advance, backspace-to-previous, paste-to-fill, and optional masking. Purpose-built for the 2FA/OTP flow.

Playground

Length
Type
Size
Variant
Loading...
Loading syntax highlighting...

01 Examples

Six-digit OTP with a completion callback

bind:value keeps the concatenated string in sync; onComplete fires once the final cell is filled — the moment to kick off verification.
One-time code
Loading...
Loading syntax highlighting...

Masked — passcode entry

mask renders each filled cell as a dot, the way a password field hides characters. Use it for standing PINs and passcodes rather than throwaway SMS codes.
PIN
Loading...
Loading syntax highlighting...

Alphanumeric with a grouped separator

type=alphanumeric widens the character set to A–Z; uppercase normalises casing as you type; separator + groupSize break a long code into readable groups — here a 4-4 license key.
License key
Loading...
Loading syntax highlighting...

Sizes

sm, md (default), and lg scale the cells together with the caret and separator. sm floors the font to 16px on touch devices so iOS Safari does not zoom on focus.
Small
Medium
Large
Loading...
Loading syntax highlighting...

Error state

Passing error colours every cell danger, sets aria-invalid, and shows the message via role=alert — overriding any helper text.
Security code
Loading...
Loading syntax highlighting...

02 Two-factor / OTP

PinInput is purpose-built for the one-time-code step of a two-factor flow. The first cell already carries autocomplete="one-time-code", so iOS surfaces the code straight from an incoming SMS as a keyboard suggestion — no extra wiring on your side. Pair it with the auth package's TwoFactorManager, feeding the bound value into your verify call from onComplete.

Give it a visible label and a helper line so the source of the code (authenticator app vs. SMS) is never ambiguous.

Authenticator verification field

A labelled, six-digit field with helper text — the shape TwoFactorManager expects at the challenge step.
Verification code
Enter the 6-digit code from your authenticator app.
Loading...
Loading syntax highlighting...

03 Customization

Every visual surface is a named slot: root (what class also targets), label, group (the cell row), cell, separator, and message. Pass slotClasses to merge classes onto any of them, or unstyled to drop all default tv() styles and rebuild from scratch. For a look you reuse across the app, register a preset once on <BlocksProvider> and reference it by name instead of repeating overrides.

Terminal-style cells via slotClasses

Larger, rounded, monospaced cells built entirely from semantic tokens — no hardcoded colours.
Access code
Loading...
Loading syntax highlighting...

04 Accessibility

  • The cell row is a role="group", named by aria-labelledby when a visible label is set, or by aria-label otherwise.
  • Each cell announces its position — aria-label="Character N of M" — so a screen-reader user always knows where the caret sits.
  • An error message is exposed via role="alert" and wired to every cell through aria-describedby, alongside aria-invalid.
  • Full keyboard support: typing a valid character auto-advances to the next cell, Backspace clears and steps back, the arrow keys plus Home / End move between cells, and a paste is distributed across the cells from the caret.

05 API Reference

30 props
30 props

No matching properties

No matching properties

06 Installation

Import

Loading...
Loading syntax highlighting...