Skip to content

PinInput

Category: Forms & inputs

{
/* SMS verification code */
}
<PinInput
length={6}
label="Verification code"
description="Sent to +82 ····-1234"
autoFocus
onComplete={async (code) => {
await verify(code);
}}
/>;
{
/* Masked 4-digit PIN */
}
<PinInput length={4} mask label="Enter PIN" />;

Install: @helix-ui/core

import { PinInput } from '@helix-ui/core';

status: stable · since: 0.5.0

Tags: otp, pin, verification, sms

[ _ ][ _ ][ _ ][ _ ][ _ ][ _ ] ← 6-digit code
  • display — inline-flex
  • width — content
  • height — content
  • intrinsicSize — ~44-56px tall, hugs N cells
  • stackable — false
  • fullBleed — false

A row of single-character cells with auto-advance, paste-to-fill, backspace-to-previous, and SMS one-time-code autofill on iOS/Android.

Name Type Default Description
length number 6 Number of cells.
value string — Controlled value.
defaultValue string — Uncontrolled initial.
onChange (value: string) => void — Change handler.
onComplete (value: string) => void — Called once when the last cell is filled.
pattern 'digits' | 'alphanumeric' digits Allowed character set.
mask boolean false Mask the value (for PINs).
isInvalid boolean false Invalid styling.
isDisabled boolean false Disable all cells.
label ReactNode — Label above the cells.
description ReactNode — Helper text.
errorMessage ReactNode — Error text. Implies isInvalid.
size 'sm' | 'md' | 'lg' md Cell size.
autoFocus boolean false Focus the first cell on mount.

color.bg.surface.default, color.bg.surface.muted, color.bg.action.brand.default, color.border.default, color.border.focus, color.border.danger, color.text.primary, color.text.secondary, color.text.action.danger, radius.md, space.2, font.family.sans, font.size.sm, font.size.md, font.size.xl, font.size.2xl, font.weight.medium, font.weight.semibold

Notes

  • First cell has autocomplete="one-time-code" so iOS / Android can offer SMS code autofill.
  • inputMode="numeric" on digit-only mode brings up the numeric keypad on mobile.
  • Error message has role="alert".
Component Relation Note
NumericKeypad sibling Pair on mobile when system keyboard is undesired.
Field wraps Wrap with Field for label/error.
TextInput sibling
Stepper sibling

These are the AI prompt → JSX mappings used by the helix-ui prompt DSL and integrations like Cursor / Claude Code.

“6-digit OTP input”

<PinInput length={6} value={code} onChange={setCode} />