Elements

Components

Pin Input

PinInput, dressed in the paper-and-ink system: one character per square-cut seal, centered ink in tabular figures. The parts — Root, Label, Control, Input, HiddenInput.

#Basic usage

pin-input/basic Vue React

#Props

#Control

A styled part — no props of its own; it takes the anatomy's shared styling.

#HiddenInput

A styled part — no props of its own; it takes the anatomy's shared styling.

#Input

PropTypeDefaultDescription
indexnumber—

#Label

A styled part — no props of its own; it takes the anatomy's shared styling.

#Root

PropTypeDefaultDescription
sizeString as PropType<"sm" | "md" | "lg">"md"One rung of the control-height ladder each seal stands on.
autoFocusbooleanWhether to auto-focus the first input.
autoSubmitbooleanWhether to auto-submit the owning form when all inputs are filled.
blurOnCompletebooleanWhether to blur the input when the value is complete
countnumberThe number of inputs to render to improve SSR aria attributes. This will be required in next major version.
defaultValuestring[]The initial value of the the pin input when rendered. Use when you don't need to control the value of the pin input.
disabledbooleanWhether the inputs are disabled
formstringThe associate form of the underlying input element.
idstringThe unique identifier of the machine.
idsPartial<{ root: string; hiddenInput: string; label: string; control: string; input(id: string): string; }>The ids of the elements in the pin input. Useful for composition.
invalidbooleanWhether the pin input is in the invalid state
maskbooleanIf true, the input's value will be masked just like type=password
modelValuestring[]The v-model value of the pin input
namestringThe name of the input element. Useful for form submission.
otpbooleanIf true, the pin input component signals to its fields that they should use autocomplete="one-time-code".
patternstringThe regular expression that the user-entered input value is checked against.
placeholderstring"○"The placeholder text for the input
readOnlybooleanWhether the pin input is in the valid state
requiredbooleanWhether the pin input is required
sanitizeValue(value: string) => stringFunction to sanitize pasted values before validation. Useful for stripping dashes, spaces, or other formatting.
selectOnFocusbooleanWhether to select input value when input is focused
translationspinInput.IntlTranslationsSpecifies the localized strings that identifies the accessibility elements and their states
type'alphanumeric' | 'numeric' | 'alphabetic'"numeric"The type of value the pin-input should allow