Applies to every preview on the site.
Installation
One command copies the source into your app — you own the code and can change anything.
After you add the file, import it like any local component:
import { OtpInput } from "@/components/ui/otp-input";Or add it with the CLI (installs any missing peers):
Usage
useKit(). Wrap your app in <KitProvider accent="#6366f1" radius={14}> to re-skin every component at once.Like this? There's a lot more in Pro Pro
12 full screens built from the same kit — install them the same way.
Props
| Prop | Type | Default |
|---|---|---|
| length Number of cells. | number | 6 |
| value / onChangeText Controlled code (digits only). Pasting a longer string fills every cell. | string | — |
| onComplete Called when every cell is filled. | (code) => void | — |
| variant Rounded box cells, underline bars, or round pill cells. | "box" | "underline" | "pill" | "box" |
| error Shakes the row and turns it the danger colour. | boolean | false |
| errorText Message (with icon) shown under the cells while `error` is set. | string | — |
| success Success colour with a staggered pulse across the cells. | boolean | false |
| successText Message with an animated check shown while `success` is set. | string | — |
| helperText Hint shown under the cells otherwise. | string | — |
| separatorAfter Draw a dash after this many cells, e.g. 3 → 123 – 456. | number | — |
| maxCellSize Largest cell width; cells shrink to fit the row and never overflow. | number | 52 |
| secure Dots instead of digits. | boolean | false |
| disabled Dims and blocks input. | boolean | false |
| autoFocus Focus on mount. | boolean | false |
| accent Active cell colour. | string | theme accent |
| style Style for the root view around the cells and message. | StyleProp<ViewStyle> | — |
| className Tailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides. | string | — |
Customization
You own the source file — tune appearance with props (no fork required for most tweaks). For brand-wide colours and radius, wrap your app in KitProvider; for one-off looks, use the style props below.
Design theme
Open Design theme on the live preview — accent, corner radius and font update every variant instantly (same as KitProvider in your app).
Variants
Pick the Variants chip above the preview, or set variant=… — "box" | "underline" | "pill".
Style props
React Native style and typed slots like fieldStyle, plus optional root className when you use NativeWind or Uniwind (cnProps from kit).
- variant
- "box" | "underline" | "pill" · default "box"Rounded box cells, underline bars, or round pill cells.
- accent
- string · default theme accentActive cell colour.
- style
- StyleProp<ViewStyle>Style for the root view around the cells and message.
- className
- stringTailwind classes on the root when using NativeWind or Uniwind. Prefer style for StyleSheet overrides.
Map tokens from your design system on Bring your design system or read Theming for KitProvider and NativeWind / Uniwind setup.
Behaviour & accessibility
- Touch
- Tapping the row focuses one hidden number-pad input. Pasting a code like 123-456 strips the non-digits and fills every cell.
- Motion
- Digits pop in on a bouncy spring and the active cell glows with a halo and a blinking caret. Errors shake the row; success pulses across the cells.
- Platforms
- Sets textContentType 'oneTimeCode' and autoComplete 'one-time-code', so codes from SMS can autofill.
- Screen readers
- The cells are hidden; the input is labelled 'One-time code, 6 digits' with a hint. Helper, error and success messages are a polite live region.
- Web
- The browser focus outline is removed; the border and halo show focus instead.
Source
FAQ
How do I make an OTP input in React Native?
npx @expokit/cli@latest add otp-input in your Expo or React Native project and it copies a ready-made OTP input into your app as plain TypeScript you can edit. It works on iOS, Android and web, and in Expo Go.Does OTP Input work in Expo Go?
react-native-svg) are all included in Expo Go.How do I add OTP Input to my Expo app?
npx @expokit/cli@latest add otp-input in your project. The CLI copies the component's source into your app and installs react-native-svg, so the code is yours to change.Is OTP Input free?
Can I change how OTP Input looks?
useKit(), so wrapping your app in <KitProvider accent radius> re-skins it with every other ExpoKit component. The code lives in your project, so you can also edit anything directly.