For AI agents: the complete documentation index is available at https://wallarm.github.io/design-system/llms.txt, the full documentation bundle is available at https://wallarm.github.io/design-system/llms-full.txt, and this page is available as Markdown at https://wallarm.github.io/design-system/components/input-otp.md.

InputOTP

A short code split into one cell per character, for codes that arrive by mail or from an authenticator — reach for Input for anything the reader knows by heart. Six cells by default, and groupSize inserts separators so the reader can check what they typed against what they were sent.

Source · Storybook

Usage

import { OTPInput } from '@wallarm-org/design-system/InputOTP';

Examples

Disabled

All cells out together. The code is a single value, so cells are never disabled individually.

With error

The invalid state across every cell, since a wrong code is wrong as a whole rather than in one position.

Numeric

Numeric entry brings up the number keypad, and the otp flag lets a password manager or the OS offer the code it has just received.

Masked

mask hides the characters as they are entered. Reserve it for codes worth hiding — masking a six-digit code the reader is copying off a screen only makes it harder.

With field

Inside Field, so the instruction above the cells comes from FieldLabel and FieldDescription — which is where to say where the code came from.

Props

OTPInput

PropTypeDefaultDescription
groupSizenumber | undefined2Number of inputs per group (separator shown between groups). Set to 0 to disable grouping.
separatorReactNode\u2014Separator element rendered between groups
errorboolean | undefinedfalseError state (maps to Ark UI invalid)
formstring | undefinedThe associate form of the underlying input element.
titlestring | undefined
maskboolean | undefinedIf true, the input's value will be masked just like type=password
patternstring | undefinedThe regular expression that the user-entered input value is checked against.
defaultCheckedboolean | undefined
defaultValuestring[] | undefinedThe initial value of the the pin input when rendered. Use when you don't need to control the value of the pin input.
autoFocusboolean | undefinedWhether to auto-focus the first input.
idstringThe unique identifier of the machine.
tabIndexnumber | undefined
relstring | undefined
onChangeChangeEventHandler<T, Element> | undefined
type"numeric" | "alphanumeric" | "alphabetic" | undefinedThe type of value the pin-input should allow
disabledboolean | undefinedWhether the inputs are disabled
namestring | undefinedThe name of the input element. Useful for form submission.
valuestring[] | undefinedThe controlled value of the the pin input.
asChildboolean | undefinedUse the provided child element as the default rendered element, combining their props and behavior.
idsElementIds | undefinedThe ids of the elements in the pin input. Useful for composition.
placeholderstring | undefinedThe placeholder text for the input
readOnlyboolean | undefinedWhether the pin input is in the valid state
requiredboolean | undefinedWhether the pin input is required
onValueChangecomplexFunction called on input change
translationsIntlTranslations | undefinedSpecifies the localized strings that identifies the accessibility elements and their states
onValueInvalidcomplexFunction called when an invalid value is entered
otpboolean | undefinedIf true, the pin input component signals to its fields that they should use autocomplete="one-time-code".
onValueCompletecomplexFunction called when all inputs have valid values
autoSubmitboolean | undefinedWhether to auto-submit the owning form when all inputs are filled.
blurOnCompleteboolean | undefinedWhether to blur the input when the value is complete
selectOnFocusboolean | undefinedWhether to select input value when input is focused
sanitizeValue((value: string) => string) | undefinedFunction to sanitize pasted values before validation. Useful for stripping dashes, spaces, or other formatting.
countnumber | undefined6The number of inputs to render to improve SSR aria attributes. This will be required in next major version.
data-testidstring | undefined