React Native MantineInputs

Select

Searchable select dropdown

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

Usage

import { useState } from 'react';
import { Select } from 'react-native-mantine';

const [value, setValue] = useState('');

<Select
  label="Choose framework"
  placeholder="Pick one"
  data={[
    { value: 'react', label: 'React' },
    { value: 'vue', label: 'Vue' },
    { value: 'svelte', label: 'Svelte' },
  ]}
  value={value}
  onChange={setValue}
  searchable
  clearable
/>

Props

PropTypeDefaultDescription
data (required)(string | SelectDataItem)[]Select data
valuestringSelected value
defaultValuestringDefault value for uncontrolled component
onChange(value: string) => voidCalled when value changes
placeholderstringPlaceholder
labelReact.ReactNodeSelect label
descriptionReact.ReactNodeSelect description
errorReact.ReactNodeError message
sizeMantineSize'md'Select size
radiusMantineNumberSize'sm'Border radius
colorMantineColor'blue'Select color
disabledbooleanfalseIf true, select will be disabled
searchablebooleanfalseIf true, select will be searchable
searchPlaceholderstring'Search...'Search placeholder
clearablebooleanfalseIf true, clear button will be shown
clearButtonLabelstring'Clear'Clear button label
maxDropdownHeightnumber400Max dropdown height
iconReact.ReactNodeIcon displayed on the left side
rightSectionReact.ReactNodeRight section
accessibilityLabelstringAccessibility label
accessibilityHintstringAccessibility hint
styleanyAdditional styles
testIDstringTest identifier used by testing frameworks

Source on GitHub · npm