React Native MantineInputs

PinInput

PIN or OTP input with auto-focus

Import: import { PinInput } from 'react-native-mantine';

Usage

import { PinInput } from 'react-native-mantine';

<PinInput
  length={6}
  type="number"
  mask={true}
  value={pin}
  onChange={setPin}
  onComplete={(value) => console.log('PIN complete:', value)}
/>

Props

PropTypeDefaultDescription
lengthnumber4Number of input fields to display
size'xs' | 'sm' | 'md' | 'lg' | 'xl'"sm"Controls input size - affects width, height, and font size of each input field
radiusnumber | "xs" | "sm" | "md" | "lg" | "xl""sm"Key of theme.radius or any valid number to set border-radius of each input
maskbooleanfalseIf true, input values will be masked with bullet character (•) like a password input
type'number' | 'alphanumeric'"number"Type of input - "number" allows only digits, "alphanumeric" allows letters and numbers
valuestringControlled value of all inputs combined. If provided, component becomes controlled
defaultValuestringDefault value for uncontrolled mode
onChange(value: string) => voidCallback fired when any input value changes, receives the combined value of all inputs
onComplete(value: string) => voidCallback fired when all inputs are filled, receives the complete value
disabledbooleanfalseIf true, all inputs will be disabled and not respond to user interactions
errorbooleanfalseIf true, inputs will display error state with red border
spacing'xs' | 'sm' | 'md' | 'lg' | 'xl'"sm"Spacing between input fields
styleViewStyleAdditional styles to apply to the container wrapping all inputs
inputStyleTextInputStyleAdditional styles to apply to each individual input field

Source on GitHub · npm