Components
Pin input

Pin Input

The pin input is optimized for entering a sequence of digits or letters. The input fields allow one character at a time. When the digit or letter is entered, focus transfers to the next input in the sequence, until every input is filled.

API reference docs for the component. Learn about the props, CSS, and other APIs of this exported module.

PinInputProps

autoFocus

boolean

Whether to auto-focus the first input.

blurOnComplete

boolean

Whether to blur the input when the value is complete

defaultValue

string[]

dir

'ltr' | 'rtl'

The document's text/writing direction.

disabled

boolean

Whether the inputs are disabled

form

string

The associate form of the underlying input element.

getRootNode

() => ShadowRoot | Node | Document

A root node to correctly resolve document in custom environments. E.x.: Iframes, Electron.

id

string

The unique identifier of the machine.

ids

Partial<{ root: string hiddenInput: string label: string control: string input(id: string): string }>

The ids of the elements in the pin input. Useful for composition.

invalid

boolean

Whether the pin input is in the invalid state

mask

boolean

If `true`, the input's value will be masked just like `type=password`

name

string

The name of the input element. Useful for form submission.

onValueChange

(details: ValueChangeDetails) => void

Function called on input change

onValueComplete

(details: ValueChangeDetails) => void

Function called when all inputs have valid values

onValueInvalid

(details: ValueInvalidDetails) => void

Function called when an invalid value is entered

otp

boolean

If `true`, the pin input component signals to its fields that they should use `autocomplete="one-time-code"`.

pattern

string

The regular expression that the user-entered input value is checked against.

placeholder

string

The placeholder text for the input

selectOnFocus

boolean

Whether to select input value when input is focused

translations

IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

type

'numeric' | 'alphabetic' | 'alphanumeric'

The type of value the pin-input should allow

value

string[]

The value of the the pin input.

PinInputContext

clearValue

() => void

Function to clear the value of the inputs.

controlProps

Dict<any>

focus

() => void

Function to focus the pin-input. This will focus the first input.

getInputProps

({ index }: { index: number }) => Dict<any>

hiddenInputProps

Dict<any>

isValueComplete

boolean

Whether all inputs are filled.

labelProps

Dict<any>

rootProps

Dict<any>

setValue

(value: string[]) => void

Function to set the value of the inputs.

setValueAtIndex

(index: number, value: string) => void

Function to set the value of the input at a specific index.

value

string[]

The value of the input as an array of strings.

valueAsString

string

The value of the input as a string.

PinInputInputProps

index

number