Skip to content
THE COMPONENT LIBRARY
Skip to content

Component reference

PinInput

A one-time verification code split into coordinated cells.

Preview

Live preview

Changes apply to this preview only.

Two-factor verification

Enter the six-digit code from your authenticator app. The code is grouped as 3 + 3 for easier reading.

Authentication code
Waiting

The verification action stays disabled until every cell is filled.

Width adapts to the available space

More examples

Different configurations and compositions using the real Pimolu API. Each preview runs independently and follows the site appearance.

Default

Six numeric cells, one-time-code autocomplete on the first cell and a labelled group.

Open preview

Grouped and alphanumeric

groups splits the cells visually without changing the single group label. type=alphanumeric accepts letters and digits.

Open preview

States

mask renders password cells; error marks every cell invalid and links the message; disabled and read-only lock the group.

Open preview

Usage

Keep verification and server errors outside the input; completion only reports local input.

API reference

Generated from the public TypeScript declarations. Native HTML attributes are inherited where the component extends them; this reference includes Pimolu props and selected common native attributes.

PimoluPinInputProps

Type source
PimoluPinInputProps public API
NameTypeDefaultDescription
valuestring[] | undefined—Controlled cells. Each entry is one cell; missing entries are empty. This positional API keeps a hole in the middle of the code from shifting the remaining digits.
defaultValuestring[] | undefined—Initial cells when uncontrolled.
onValueChange((value: string[]) => void) | undefined—Called with the next cell array after every edit.
onComplete((value: string) => void) | undefined—Called once when the last empty cell is filled.
lengthnumber | undefined6Number of cells. Defaults to 6.
typePimoluPinInputType | undefined"numeric"Accepted characters. Defaults to "numeric".
maskboolean | undefinedfalseRender the cells as password fields.
disabledboolean | undefinedfalsePublic Pimolu prop; see the source declaration for details.
readOnlyboolean | undefinedfalsePublic Pimolu prop; see the source declaration for details.
errorboolean | undefinedfalseInvalid state, announced on every cell.
helperTextReactNode—Supporting text below the cells.
errorMessageReactNode—Error text below the cells.
labelReactNode—Visible label, also used as the accessible name of the group.
autoFocusboolean | undefinedfalseFocus the first empty cell on mount.
groupsnumber[] | undefined—Split the cells into visual groups, e.g. `[3, 3]`. Ignored unless the sizes are positive integers that add up to `length`.
classNamestring | undefined—Class applied to the outer group.
styleCSSProperties | undefined—Standard React/HTML attribute.
aria-labelstring | undefined—Defines a string value that labels the current element.
childrenReactNode—Standard React/HTML attribute.
onClickMouseEventHandler<HTMLDivElement> | undefined—Standard React/HTML attribute.
value

string[] | undefined

No default extracted.

Controlled cells. Each entry is one cell; missing entries are empty. This positional API keeps a hole in the middle of the code from shifting the remaining digits.

defaultValue

string[] | undefined

No default extracted.

Initial cells when uncontrolled.

onValueChange

((value: string[]) => void) | undefined

No default extracted.

Called with the next cell array after every edit.

onComplete

((value: string) => void) | undefined

No default extracted.

Called once when the last empty cell is filled.

length

number | undefined

Default: 6

Number of cells. Defaults to 6.

type

PimoluPinInputType | undefined

Default: "numeric"

Accepted characters. Defaults to "numeric".

mask

boolean | undefined

Default: false

Render the cells as password fields.

disabled

boolean | undefined

Default: false

Public Pimolu prop; see the source declaration for details.

readOnly

boolean | undefined

Default: false

Public Pimolu prop; see the source declaration for details.

error

boolean | undefined

Default: false

Invalid state, announced on every cell.

helperText

ReactNode

No default extracted.

Supporting text below the cells.

errorMessage

ReactNode

No default extracted.

Error text below the cells.

label

ReactNode

No default extracted.

Visible label, also used as the accessible name of the group.

autoFocus

boolean | undefined

Default: false

Focus the first empty cell on mount.

groups

number[] | undefined

No default extracted.

Split the cells into visual groups, e.g. `[3, 3]`. Ignored unless the sizes are positive integers that add up to `length`.

className

string | undefined

No default extracted.

Class applied to the outer group.

style

CSSProperties | undefined

No default extracted.

Standard React/HTML attribute.

aria-label

string | undefined

No default extracted.

Defines a string value that labels the current element.

children

ReactNode

No default extracted.

Standard React/HTML attribute.

onClick

MouseEventHandler<HTMLDivElement> | undefined

No default extracted.

Standard React/HTML attribute.

Accessibility

  • Label the code entry, test paste/backspace and do not prevent password-manager or OTP autofill.
Read the accessibility guide →