OTP Input
A discrete multi-cell numeric pin input for one-time passwords and verification codes.
v0.2.2NativeWindStyleSheetiOSAndroidExpo GoWeb
Preview
Installation
npx nativra-cli add otp-inputWrites OtpInput.tsx to components/ui, rewrites imports to your aliases and records hashes in nativra.lock.json, along with 2 registry dependencies. Existing files are never overwritten without asking.
Want to try it first? Open it in the playground: a real React Native project in your browser, with this item installed by the CLI.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| length | number | 6 | Total number of PIN digit boxes |
| value | string | required | Controlled numeric PIN code |
| onChangeText | (value: string) => void | required | Callback when PIN digits change |
| error | boolean | false | Highlights input boxes in destructive color |
| secureTextEntry | boolean | false | Obscures entered PIN with dots |
| disabled | boolean | false | Disables PIN input |
Source
Exactly what the CLI writes, before your import aliases are applied.
Dependencies
Registry items
- useThemeColorsHookReturns the installed theme's semantic colors for the current light/dark scheme, and the installed style's tokens and helpers. Used by every component.
- Class Names UtilityUtilityUtility function for conditionally merging class names with clsx and tailwind-merge (NativeWind) or flattening style objects (StyleSheet).