foontofoonto

Component

OTP Input

A segmented OTP / PIN field where each digit bounces in.

How to use

Minimal, copy-pasteable code.

Verify.tsx
import { useState } from "react";
import { OtpInput } from "react-native-foonto";

export function Verify() {
  const [code, setCode] = useState("");

  return (
    <OtpInput
      length={4}
      value={code}
      onChange={setCode}
      onComplete={(value) => console.log("submit", value)}
      autoFocus
    />
  );
}

Props

PropTypeDefaultDescription
valuereqstringControlled value (digits only).
onChangereq(value: string) => voidCalled on every edit.
lengthnumber4Number of digit cells.
onComplete(value: string) => voidCalled once the final digit is entered.
autoFocusbooleanfalseFocus the field on mount.
securebooleanfalseMask digits with dots.
cellSizenumber56Edge length of each cell in px.
cellGapnumber12Gap between cells in px.
focusColorstring'#6d28d9'Highlight color for the active/filled cell.
styleFoontoStyleStyle for the row.

AI prompt

Install the library, then paste this into your AI coding agent to wire it up.

AI prompt
Add a segmented OTP / PIN input using the `react-native-foonto` library.

1. Make sure `react-native-foonto` and `react-native-reanimated` are installed.
2. Import `OtpInput` from `react-native-foonto`.
3. Store the code in `useState` and pass `value` + `onChange`.
4. Set `length` to your code size and handle `onComplete` to submit/verify.
5. Use `autoFocus` so the keyboard opens immediately; set `secure` for PINs.