Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-native-input-select

azeezat13.7kMIT2.1.8TypeScript support: included

A customizable dropdown selection package for react-native for android and iOS with multiple select and search capabilities.

react-native, ios, android, dropdown, selection, dropdown menu, multiple select, picker, pull-down menu, combo box, list box

readme

NPM

npm version GitHub stars CodeQL Release & Publish to NPM coverage

react-native-input-select

A fully customizable dropdown selection package for react-native android and iOS with multiple select and search capabilities.

Installation

With npm

npm install react-native-input-select

With yarn

yarn add react-native-input-select

Sandbox

See more examples in Sandbox

iOS

| | | | | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | Screenshot 2023-07-08 at 12 34 23 AM | Screenshot 2023-07-08 at 12 39 51 AM | Screenshot 2023-07-08 at 12 29 16 AM | | Screenshot 2023-07-08 at 12 28 57 AM | Screenshot 2023-07-08 at 12 20 52 AM | Screenshot 2023-07-08 at 12 21 06 AM |

Android

| | | | | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | Screenshot 2023-05-16 at 6 17 09 AM | Screenshot 2023-03-23 at 5 26 58 PM | Screenshot 2023-03-23 at 5 28 49 PM |

Basic Usage

import React from 'react';
import Dropdown from 'react-native-input-select';

export default function App() {
  const [country, setCountry] = React.useState();

  return (
    <Dropdown
      label="Country"
      placeholder="Select an option..."
      options={[
        { label: 'Nigeria', value: 'NG' },
        { label:land Islands', value: 'AX' },
        { label: 'Algeria', value: 'DZ' },
        { label: 'American Samoa', value: 'AS' },
        { label: 'Andorra', value: 'AD' },
      ]}
      selectedValue={country}
      onValueChange={(value) => setCountry(value)}
      primaryColor={'green'}
    />
  );
}

Advanced Usage With Flat List

import React from 'react';
import Dropdown from 'react-native-input-select';
import { View, StyleSheet, Text, Button, Alert, Image } from 'react-native';

export default function App() {
  const [country, setCountry] = React.useState();

  return (
    <Dropdown
      label="Customized components in list"
      placeholder="Select multiple countries..."
      options={countries.slice(0, 30)}
      optionLabel={'name'}
      optionValue={'code'}
      selectedValue={country}
      onValueChange={(itemValue: any) => setCountry(itemValue)}
      isMultiple
      isSearchable
      primaryColor={'orange'}
      dropdownStyle={{
        borderWidth: 0, // To remove border, set borderWidth to 0
      }}
      dropdownIcon={
        <Image
          style={styles.tinyLogo}
          source={{
            uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg==',
          }}
        />
      }
      dropdownIconStyle={{ top: 20, right: 20 }}
      listHeaderComponent={
        <View style={styles.customComponentContainer}>
          <Text style={styles.text}>
            💡 You can add any component to the top of this list
          </Text>
          <View style={styles.fixToText}>
            <Button
              title="Left button"
              onPress={() => Alert.alert('Left button pressed')}
              color="#007AFF"
            />
            <Button
              title="Right button"
              onPress={() => Alert.alert('Right button pressed')}
            />
          </View>
        </View>
      }
      listFooterComponent={
        <View style={styles.customComponentContainer}>
          <Text>You can add any component to the bottom of this list</Text>
        </View>
      }
      modalControls={{
        modalOptionsContainerStyle: {
          padding: 10,
          backgroundColor: 'cyan',
        },
        modalProps: {
          supportedOrientations: [
            'portrait',
            'portrait-upside-down',
            'landscape',
            'landscape-left',
            'landscape-right',
          ],
          transparent: false,
        },
      }}
      listComponentStyles={{
        listEmptyComponentStyle: {
          color: 'red',
        },
        itemSeparatorStyle: {
          opacity: 0,
          borderColor: 'white',
          borderWidth: 2,
          backgroundColor: 'cyan',
        },
        sectionHeaderStyle: {
          padding: 10,
          backgroundColor: 'cyan',
        },
      }}
      listControls={{
        selectAllText: 'Choose everything',
        unselectAllText: 'Remove everything',
        selectAllCallback: () => Alert.alert('You selected everything'),
        unselectAllCallback: () => Alert.alert('You removed everything'),
        emptyListMessage: 'No record found',
      }}
      selectedItemsControls={{
        removeItemIcon: (
          <Image
            source={{
              uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA',
            }}
            style={{ tintColor: 'white', height: 12, width: 12 }}
          />
        ),
        onRemoveItem: () => Alert.alert('Item was removed'),
        showRemoveIcon: true,
      }}
    />
  );
}

const styles = StyleSheet.create({
  customComponentContainer: {
    paddingHorizontal: 20,
    paddingVertical: 10,
  },
  text: {
    marginBottom: 20,
  },
  fixToText: {
    flexDirection: 'row',
    justifyContent: 'space-between',
  },
  tinyLogo: {
    width: 20,
    height: 20,
  },
  radioButton: {
    width: 20,
    height: 20,
    borderRadius: 20 / 2,
    borderWidth: 3,
    borderColor: 'white',
  },
});

Advanced Usage with Section List

<DropdownSelect
  label="Menu"
  placeholder="Select multiple dishes..."
  options={[
    {
      title: 'Main dishes',
      data: [
        { label: 'Pizza', value: 'A' },
        { label: 'Burger', value: 'B' },
        { label: 'Risotto', value: 'C' },
      ],
    },
    {
      title: 'Sides',
      data: [
        { label: 'Ice cream', value: 'D' },
        { label: 'Cheesecake', value: 'E' },
      ],
    },
    {
      title: 'Drinks',
      data: [
        { label: 'Water', value: 'F' },
        { label: 'Coke', value: 'G' },
        { label: 'Juice', value: 'H' },
      ],
    },
  ]}
  selectedValue={menu}
  onValueChange={(itemValue: any) => setMenu(itemValue)}
  isMultiple
  isSearchable
  primaryColor={'deepskyblue'}
  listComponentStyles={{
    sectionHeaderStyle: {
      padding: 10,
      backgroundColor: 'green',
      color: 'white',
      width: '30%',
    },
  }}
/>

For more examples visit our wiki page

Props

Proptypes Datatype Example
label string or ReactComponent Countries or <Text> You can add any component here <Text>
placeholder string Select a country
options Array [{ name: 'Nigeria', code: 'NG' }, { name: 'Albania', code: 'AL' }]
optionLabel string name
optionValue string code
error string This is a requiredfield
helperText string Only few countries are listed
selectedValue string or Array AL or [AL, AX]
onValueChange function ()=>{}
isMultiple Boolean true
isSearchable Boolean true
disabled Boolean true
dropdownIcon React Component Image or <Text> Show <Text>
labelStyle Object {color: 'red', fontSize: 15, fontWeight: '500'}
placeholderStyle Object {color: 'blue', fontSize: 15, fontWeight: '500'}
dropdownStyle Object {borderColor: 'blue', margin: 5, borderWidth:0 ...}
dropdownContainerStyle Object {backgroundColor: 'red', width: '30%', ...}
dropdownIconStyle Object {top: 10 , right: 10, ...}
selectedItemStyle Object {fontWeight: '600', color: 'yellow', ...}
multipleSelectedItemStyle Object {backgroundColor: 'red', color: 'yellow', ...}
dropdownErrorStyle Object {borderWidth: 2, borderStyle: 'solid'}
dropdownErrorTextStyle Object {color: 'red', fontWeight:'500'}
dropdownHelperTextStyle Object {color: 'green', fontWeight:'500'}
primaryColor string blue
autoCloseOnSelect boolean false
listHeaderComponent React Component <Text> You can add any component here </Text>
listFooterComponent React Component <Text> You can add any component here <Text>
listComponentStyles Object {listEmptyComponentStyle: ViewStyle, itemSeparatorStyle: ViewStyle, sectionHeaderStyle: TextStyle}
listEmptyComponent React Component <Text> You can add any component here <Text>
checkboxControls Object {checkboxSize: number, checkboxStyle: ViewStyle, checkboxLabelStyle: TextStyle, checkboxComponent?: React.ReactNode, checkboxDisabledStyle?: ViewStyle, checkboxUnselectedColor?: ColorValue}
listControls Object { selectAllText: 'Choose all', unselectAllText: 'Remove all', selectAllCallback: () => {}, unselectAllCallback: () => {}, hideSelectAll: boolean, emptyListMessage: 'No record found', keyboardShouldPersistTaps: "always" }
searchControls Object { textInputStyle: ViewStyle | TextStyle, textInputContainerStyle: ViewStyle, textInputProps: TextInputProps, searchCallback:(value)=>{}}
modalControls Object { modalBackgroundStyle: ViewStyle, modalOptionsContainerStyle: ViewStyle, modalProps: ModalProps}
minSelectableItems number 3
maxSelectableItems number 5
selectedItemsControls Object { removeItemIcon: ReactNode, onRemoveItem: ()=>{}, showRemoveIcon: boolean}
ref useRef<DropdownSelectHandle | null>(null) Use this to open or close the modal as needed e.g dropdownRef.current?.open() or dropdownRef.current?.close()

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Made with contrib.rocks.

Discussion

For discussion and feedback on this library. You can access it by heading over to the Discussions Tab on Github. We've created some sections to keep the discussion focused.

Title Topic
Announcements 📣 General announcements about this library.
Show and tell 🙌 Show off something you've made out of this library
Ideas 💡 A place to Share ideas for new features.
Polls 🗳️ Take a vote from the community
Q&A 🤝 A place to ask the community for help on the New Architecture topics
General 💬 Chat about anything and everything here

License

MIT

Video Demo

https://github.com/azeezat/react-native-select/assets/9849221/194bf5cf-1a2d-4ca6-9585-05d6bb987aba

changelog

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

v2.1.7

  • fix: remove clear all or select all if all options are disabled. #117

v2.1.6

29 June 2025

  • added functionality to remove item from selected items list #113
  • add minSelectableItems #115
  • chore: release v2.1.6 9dc6019

v2.1.5

29 June 2025

  • fix: remove check icon when checkbox is unchecked. #114
  • chore: release v2.1.5 e1a39cf

v2.1.4

13 June 2025

  • Chore: Dependency updates #110
  • Update README.md #109
  • chore: release v2.1.4 ce2aa8d

v2.1.3

16 February 2025

  • feat: allow setting keyboardShouldPersistTaps #102
  • chore: lint fixes 525bf4c
  • chore: release v2.1.3 8867226
  • chore: coverage permissions ee6166a

v2.1.2

3 February 2025

v2.1.1

15 December 2024

  • update project dependencies #99
  • reset options list to initial state when search input is cleared #98
  • chore: update scripts f5a20ee
  • chore: release v2.1.1 20048ad
  • chore: fix coveralls ee3c9a1

v2.1.0

8 October 2024

  • Fix: Handle zero and boolean values properly in options array #92
  • fix: enforce label to a string, so we avoid the issue of a label being numerical 0 #91
  • chore: removed deprecated props #89
  • option type fixes 927ab7b
  • chore: release v2.1.0 647bcb6
  • fix: type fixes a24ddac

v2.0.0

4 October 2024

  • chore: refactored code to use custom hooks #86
  • chore: release v2.0.0 f142ce6

v1.3.18

6 September 2024

v1.3.17

5 September 2024

  • chore: release v1.3.17 2b16d6e
  • chore: update release-it script aad9ef7

v1.3.16

5 September 2024

  • fix: typescript error #84
  • chore: updated release-it script 16fb1d3
  • chore: release v1.3.16 832de5c

v1.3.15

1 September 2024

  • feat: Added checkboxUnselectedColor and checkboxDisabledStyle to checkboxControls Object #81
  • feat: Added checkboxUnselectedColor and checkboxDisabledStyle 53de256
  • chore: release v1.3.15 d75bc21

v1.3.14

31 August 2024

v1.3.13

29 August 2024

v1.3.11

29 August 2024

  • fix: allow addition of custom component to dropdown list, added unit … #77
  • fix: allow addition of custom component to dropdown list, added unit tests, added autoCloseOnSelect prop. cbc3dac
  • fix: allow addition of custom component to dropdown list, added unit tests, added autoCloseOnSelect prop. 6c83c0d
  • chore: scripts cleanup 52df045

v1.3.8

27 June 2024

v1.3.7

15 June 2024

  • Chore/dependency updates #72
  • chore: updated dependencies fb1a728
  • fix: android build 480781e
  • fix: Added onDismiss functionality to modal for Android 30a3427

v1.3.6

13 May 2024

  • fix #51 #69
  • Merge pull request #69 from billomore/main #51
  • fix keyboard safe area for ios 667e23f
  • fix keyboard safe area 468bf4f
  • lint a2271f6

v1.3.5

22 February 2024

  • fix: checkbox controls #62
  • chore: release 1.3.5 b8fcaf0

v1.3.4

19 February 2024

  • chore: type fixes and deprecation notices #60
  • type fixes and deprecation notices 3c87a04
  • chore: release 1.3.4 e0cf9b8

v1.3.3

30 November 2023

  • fix: search regex issue #54
  • chore: release 1.3.3 ab65414

v1.3.2

4 October 2023

  • Fixed Dropdown disabled bahviour #50
  • added disabled and protected toggle modal 4ab11dd
  • chore: release 1.3.2 7e49a9c

v1.3.1

23 September 2023

  • fix: scroll to index fix #49
  • chore: release 1.3.1 555a7a5

v1.3.0

14 September 2023

  • feat: hide select all control #46
  • chore: release 1.3.0 b2e5de9

v1.2.0

11 September 2023

  • feat: added new prop for empty list message #44
  • chore: release 1.2.0 1720389

v1.1.10

10 September 2023

  • fix: unexpected close of expo modal #43
  • chore: release 1.1.10 434d729

v1.1.9

10 September 2023

v1.1.8

10 September 2023

  • fix: allow empty options #42
  • chore: release 1.1.8 d0a58ad

v1.1.7

8 September 2023

  • refactor: searchControls #39
  • chore: release 1.1.7 9e82607

v1.1.6

7 September 2023

  • fix: Search and select all issues #37
  • chore: delete unused folder ee7f98a
  • fix: remove redundant functions 9ac7d59
  • Update README.md 22f0d5a

v1.1.5

2 September 2023

v1.1.4

2 September 2023

  • feat: added selectAllControls prop #33
  • chore: release 1.1.4 7b8c895

v1.1.3

15 August 2023

  • Added checkbox component #31
  • Update README.md #26
  • Update README.md #24
  • feat: updated docs 19e0f77
  • chore: release 1.1.3 f8e71bb
  • refactor: set version automatically 4302fa3

v1.1.2

25 July 2023

  • feat: added scroll to view #23
  • chore: release 1.1.2 215faeb

v1.1.1

17 July 2023

  • feat: Added section list #18
  • fix: fixed github actions a989a02
  • fix: fixed npm script c7f6052
  • fix: fixed release github action 162e4a3

v0.35.0

29 June 2023

  • fix: fixed checkbox color #17
  • removed npm github action 66da4e2
  • chore: release 0.35.0 7fc8757

v0.34.0

15 June 2023

  • Allow custom ModalProps to be passed to Modal #15
  • update README with hideModal prop #14
  • updated examples 7c295b1
  • Update README.md d817517
  • Update README.md bad8043

v0.33.0

10 June 2023

  • fix null value propagation on unselect #13
  • add prop to trigger hiding of modal #12
  • center align items on vertical axis #11
  • Create CODE_OF_CONDUCT.md #10
  • fix: ios build 876e658
  • chore: release 0.33.0 8c64d4f
  • fixes unselect null value propagation 08c9987

v0.32.0

22 May 2023

  • Feature/re render view with initial value #9
  • install lib packages 6aa8868
  • fix: removed lock file 5b61298
  • fix: multiple select fix 1416c9d

v0.31.0

16 May 2023

  • fix: modalOptionsContainer Styles does not apply custom styles #8
  • fix: 5bebea9
  • chore: release 0.31.0 2555432

v0.30.0

12 May 2023

  • Adding the ability to override the dropdown icon styles #6
  • added dropdownIcon prop 9b5ed22
  • chore: release 0.30.0 27cd662

v0.29.0

20 April 2023

v0.28.0

14 April 2023

  • feat: added new props for header and footer component 4f7af81
  • chore: release 0.28.0 df7d749

v0.27.0

12 April 2023

  • fix: updated outline style and fixed select all ad2ba17
  • chore: release 0.27.0 64abfee

v0.26.0

10 April 2023

  • Added placeholder style to DropdownSelectedItemsView #4
  • fix: updated example 73a692f
  • Update README.md 2ed3843
  • Added placeholderStyle 70b07f0

v0.25.0

6 April 2023

  • feat: added disabled functionality 3eb22b0
  • chore: release 0.25.0 e2df8b3

v0.24.0

2 April 2023

  • feat: added select all 70e6411
  • Create npm-publish-github-packages.yml 05c8330
  • chore: release 0.24.0 3c2e539

v0.23.0

30 March 2023

v0.22.0

19 March 2023

v0.21.0

19 March 2023

v0.20.0

18 March 2023

  • feat: removed @react-native-community/checkbox dependency #3
  • Feat/react version upgrade #2
  • feature: updated react examples and fixed bugs d236c3b
  • Create codeql.yml 824e81b
  • Delete codeql.yml 76543bd

v0.18.0

24 January 2022

v0.17.0

22 January 2022

v0.16.0

12 January 2022

v0.15.0

12 January 2022

v0.14.0

8 January 2022

v0.13.0

8 January 2022

v0.12.0

8 January 2022

v0.11.0

8 January 2022

v0.10.0

8 January 2022

v0.7.0

7 January 2022

  • fix: cleared search input after closing modal 51abb11
  • chore: release 0.7.0 bb7141c

v0.6.0

7 January 2022

v0.5.0

7 January 2022

v0.4.0

4 January 2022

v0.3.0

4 January 2022

v0.2.0

4 January 2022