OTP Input
A field for one-time passwords and verification codes, entered one digit per cell, with autofill.
import { OTPInput } from "@plexui/react-native"Examples
Overview
Platforms
| iOS 26 | Android | |
|---|---|---|
| Native component | None: a text field for a one-time code, drawn as the Plex cells | None: the Plex Android code boxes |
| Look | 44 by 52pt capsule cells, a dot in an empty cell, the outline darkening on focus | 32.7 by 40.8dp outlined boxes with 4dp corners, the line in the accent on focus |
API
| Prop | Type | Default | Description |
|---|---|---|---|
length | number | 6 | Number of digit cells |
value | string | — | Controlled value |
onChange | (value: string) => void | — | Called when value changes |
onComplete | (value: string) => void | — | Called when all digits filled |
grouping | number[] | — | Grouping pattern with extra gap (e.g. [3,3]) |
invalid | boolean | false | Invalid visual state |
errorMessage | string | — | Error message below the input |
disabled | boolean | false | Disable all cells |
autoFocus | boolean | false | Auto-focus first cell on mount |
aria-label | string | — | Names the code ("Verification code"): the cells' group on the web, and the start of each cell's name on iOS and Android ("Verification code, digit 1 of 6"), where a group is not announced |
label | string | — | The same name as aria-label |
digitLabel | (index: number, length: number) => string | Digit 1, or digit 1 of 6 once the code is named | The name of a cell, for another language |
style | StyleProp<ViewStyle> | — | Style of the root |
testID | string | — | Test id of the root; each cell's field takes it with -digit-1, -digit-2 and so on |
Each digit stays in its own cell: typing into a later empty cell keeps the digit there, and clearing a cell in the middle does not move the others. The value is the filled digits in order. Pasting or typing several digits writes them from the focused cell onward.