🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

react-native-dropdown-with-search-and-checkbox

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-dropdown-with-search-and-checkbox

A React Native dropdown with search and checkbox functionality

1.0.8
latest
npm
Version published
Weekly downloads
569
Maintainers
1
Weekly downloads
 
Created
Source

react-native-dropdown-with-search-and-checkbox

A customizable React Native dropdown component featuring search functionality and checkbox selection (single & multiple). Ideal for creating dynamic, user-friendly dropdowns in your mobile applications.

Features

  • 🔍 Searchable Dropdown: Easily search through the options.
  • ☑️ Checkbox Selection: Supports both single and multiple selection.
  • 📱 Modal-based Dropdown: Beautiful modal dropdown UI.
  • 🎨 Customizable Styles: Extensive styling options for every aspect of the dropdown.

Installation

Install the package using npm:

npm install react-native-dropdown-with-search-and-checkbox

Additionally, make sure to install the required dependencies:

npm install react-native-elements react-native-vector-icons

For React Native versions below 0.60, link react-native-vector-icons manually:

npx react-native link react-native-vector-icons

Usage

To use the dropdown in your React Native app, follow the example below:

Basic Example

import React, { useState } from 'react';
import { View, Text } from 'react-native';
import { DropdownSearch } from 'react-native-dropdown-with-search-and-checkbox';

const App = () => {
  const [selectedItems, setSelectedItems] = useState([]);

  const data = [
    { label: 'Apple', value: 'apple' },
    { label: 'Banana', value: 'banana' },
    { label: 'Mango', value: 'mango' },
  ];

  return (
    <View style={{ flex: 1, justifyContent: 'center' }}>
      <Text>Select Fruits</Text>
      <DropdownSearch
        label="Fruits"
        data={data}
        placeholder="Select fruits"
        multiSelect={true}
        showCheckbox="multiple"
        showFilter={true}
        onSelect={(items) => setSelectedItems(items)}
      />
    </View>
  );
};

export default App;

Example 1 Search with Single Select :

Screenshot

Dropdown Screenshot

Dropdown Screenshot

Dropdown Screenshot

Props

PropTypeDefaultDescription
dataarray[]List of items to display in the dropdown
onSelectfuncrequiredCallback function to handle selected items
labelstring''Label displayed above the dropdown
placeholderstring'Select...'Placeholder text displayed when no selection is made
labelKeystring'label'The key name to access the label in each data item
valueKeystring'value'The key name to access the value in each data item
multiSelectboolfalseEnables or disables multiple selection
showCheckboxstringnullSet to 'multiple' to display checkboxes for multiple selection
showFilterboolfalseShows the filter icon and search input
saveButtonTextstring'Save'Text for the Save button when multiple items are selected
placeholderStyleobject{}Custom styling for the placeholder text
downArrowStyleobject{}Custom styling for the dropdown arrow icon
filterIconStyleobject{}Custom styling for the filter icon
searchInputStyleobject{}Custom styling for the search input
dropdownButtonStyleobject{}Custom styling for the dropdown button
checkboxStyleobject{}Custom styling for the checkbox
checkboxColorstring'#007bff'Color for the checkbox

Example 2 Search with Multiple Select :

Screenshot

Dropdown Screenshot

Dropdown Screenshot

Dropdown Screenshot

Example with Multiple Selection

import React, { useState } from 'react';
import { View, Text } from 'react-native';
import { DropdownSearch } from 'react-native-dropdown-with-search-and-checkbox';

const MultiSelectExample = () => {
  const [selectedItems, setSelectedItems] = useState([]);

  const data = [
    { label: 'Apple', value: 'apple' },
    { label: 'Banana', value: 'banana' },
    { label: 'Mango', value: 'mango' },
  ];

  return (
    <View style={{ flex: 1, justifyContent: 'center' }}>
      <Text>Multi-select Fruits</Text>
      <DropdownSearch
        label="Fruits"
        data={data}
        placeholder="Select fruits"
        multiSelect={true}
        showCheckbox="multiple"
        onSelect={(items) => setSelectedItems(items)}
      />
      <Text>Selected: {selectedItems.map(item => item.label).join(', ')}</Text>
    </View>
  );
};

export default MultiSelectExample;

Example 3 Search with Multi Select :

Screenshot

Dropdown Screenshot

License

MIT

Author

Bhumit Dara

  • GitHub: @bhumitdara
  • NPM: @bhumitdara

Keywords

react-native

FAQs

Package last updated on 29 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts