react-dropdown vs react-dropdown-select vs react-native-picker-select vs react-native-select-dropdown vs react-select
Dropdown and Select Components for React and React Native
react-dropdownreact-dropdown-selectreact-native-picker-selectreact-native-select-dropdownreact-selectSimilar Packages:

Dropdown and Select Components for React and React Native

Dropdown and select components are essential UI elements in web and mobile applications, allowing users to choose from a list of options. These components can range from simple single-select dropdowns to more complex multi-select and searchable dropdowns. They are widely used in forms, filters, and anywhere user input is required. The choice of a dropdown or select component depends on the specific requirements of the project, such as the need for multi-selection, search functionality, customization, and whether the application is web-based or mobile. Libraries like react-select offer advanced features like async loading, custom styling, and accessibility support, making them suitable for more complex use cases. On the other hand, simpler components like react-dropdown may be more appropriate for lightweight applications where basic functionality is sufficient.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
react-dropdown62,65167024 kB110-MIT
react-dropdown-select0362187 kB32a year agoMIT
react-native-picker-select01,85145.8 kB1042 years agoMIT
react-native-select-dropdown036335.5 kB552 years agoMIT
react-select028,041726 kB48710 months agoMIT

Feature Comparison: react-dropdown vs react-dropdown-select vs react-native-picker-select vs react-native-select-dropdown vs react-select

Customization

  • react-dropdown:

    react-dropdown allows for basic customization, including styling the dropdown and its items using CSS. However, it does not provide extensive APIs for deep customization.

  • react-dropdown-select:

    react-dropdown-select offers more customization options, including the ability to style the dropdown, select, and multi-select components. It also supports custom rendering for options and selected items, making it more flexible for designers.

  • react-native-picker-select:

    react-native-picker-select provides good customization capabilities, allowing developers to style the select input, placeholder, and individual options. It supports custom components for the select input and options, enabling more creative designs.

  • react-native-select-dropdown:

    react-native-select-dropdown offers basic customization for the dropdown button and its items. It allows for custom styling and the use of icons, but it is more limited compared to other libraries in terms of customizable features.

  • react-select:

    react-select is highly customizable, with support for custom styling, theming, and rendering of options, selected items, and the control. It provides a rich API for customization, making it suitable for applications that require a unique look and feel.

Multi-Select Support

  • react-dropdown:

    react-dropdown does not support multi-selection; it is designed for single selection only.

  • react-dropdown-select:

    react-dropdown-select supports both single and multi-selection, making it more versatile for forms that require selecting multiple items.

  • react-native-picker-select:

    react-native-picker-select is primarily a single-select component, but it can be extended to support multi-selection with additional implementation.

  • react-native-select-dropdown:

    react-native-select-dropdown supports single selection only, with no built-in multi-select functionality.

  • react-select:

    react-select supports both single and multi-selection out of the box, making it a great choice for applications that need flexible selection capabilities.

Accessibility

  • react-dropdown:

    react-dropdown provides basic accessibility features, but it may require additional work to ensure full compliance with accessibility standards.

  • react-dropdown-select:

    react-dropdown-select is designed with accessibility in mind, offering better support for screen readers and keyboard navigation compared to basic dropdowns.

  • react-native-picker-select:

    react-native-picker-select is built with accessibility in mind, providing support for screen readers and keyboard navigation on mobile devices.

  • react-native-select-dropdown:

    react-native-select-dropdown offers basic accessibility features, but it may not be fully optimized for screen readers and keyboard navigation.

  • react-select:

    react-select is highly accessible, with features like ARIA roles, keyboard navigation, and support for screen readers, making it one of the best choices for accessibility in dropdown components.

Code Example

  • react-dropdown:

    Simple Dropdown Example

    import React from 'react';
    import Dropdown from 'react-dropdown';
    import 'react-dropdown/style.css';
    
    const options = ['Option 1', 'Option 2', 'Option 3'];
    const defaultOption = options[0];
    
    const SimpleDropdown = () => {
      return (
        <Dropdown options={options} value={defaultOption} onChange={(option) => console.log(option)} />
      );
    };
    
    export default SimpleDropdown;
    
  • react-dropdown-select:

    Multi-Select Example

    import React from 'react';
    import { Select } from 'react-dropdown-select';
    
    const options = [
      { value: 1, label: 'Option 1' },
      { value: 2, label: 'Option 2' },
      { value: 3, label: 'Option 3' },
    ];
    
    const MultiSelect = () => {
      return <Select options={options} multi onChange={(values) => console.log(values)} />;
    };
    
    export default MultiSelect;
    
  • react-native-picker-select:

    Customizable Picker Example

    import React from 'react';
    import RNPickerSelect from 'react-native-picker-select';
    import { View, Text } from 'react-native';
    
    const CustomPicker = () => {
      return (
        <View>
          <Text>Select an option:</Text>
          <RNPickerSelect
            onValueChange={(value) => console.log(value)}
            items={[
              { label: 'Option 1', value: 'option1' },
              { label: 'Option 2', value: 'option2' },
              { label: 'Option 3', value: 'option3' },
            ]}
          />
        </View>
      );
    };
    
    export default CustomPicker;
    
  • react-native-select-dropdown:

    Simple Select Dropdown Example

    import React from 'react';
    import { View } from 'react-native';
    import SelectDropdown from 'react-native-select-dropdown';
    
    const SimpleDropdown = () => {
      const countries = ['USA', 'Canada', 'Mexico'];
    
      return (
        <View>
          <SelectDropdown
            data={countries}
            onSelect={(selectedItem) => console.log(selectedItem)}
            defaultButtonText="Select Country"
          />
        </View>
      );
    };
    
    export default SimpleDropdown;
    
  • react-select:

    Advanced Select Example

    import React from 'react';
    import Select from 'react-select';
    
    const options = [
      { value: 'chocolate', label: 'Chocolate' },
      { value: 'strawberry', label: 'Strawberry' },
      { value: 'vanilla', label: 'Vanilla' },
    ];
    
    const handleChange = (selectedOption) => {
      console.log(`Selected: ${selectedOption.label}`);
    };
    
    const AdvancedSelect = () => {
      return <Select options={options} onChange={handleChange} />;
    };
    
    export default AdvancedSelect;
    

How to Choose: react-dropdown vs react-dropdown-select vs react-native-picker-select vs react-native-select-dropdown vs react-select

  • react-dropdown:

    Choose react-dropdown if you need a simple, lightweight dropdown component for basic use cases. It is easy to implement and customize, making it ideal for projects that require straightforward functionality without the need for advanced features.

  • react-dropdown-select:

    Select react-dropdown-select if you require a more feature-rich dropdown that supports single and multi-selection, as well as tagging. It offers better customization and accessibility compared to basic dropdowns, making it suitable for forms that need more flexibility.

  • react-native-picker-select:

    Opt for react-native-picker-select if you are building a React Native application and need a customizable select component that works well on both iOS and Android. It provides a simple API and allows for custom styling and placeholder support, making it versatile for mobile apps.

  • react-native-select-dropdown:

    Choose react-native-select-dropdown if you need a lightweight and easy-to-use dropdown component for React Native. It supports single selection and offers basic customization, making it a good choice for mobile apps that require a simple dropdown without too many features.

  • react-select:

    Go with react-select if you need a highly customizable and feature-rich dropdown for React applications. It supports single and multi-selection, async options, and has excellent accessibility features. This library is ideal for complex forms and applications that require advanced functionality and styling capabilities.

README for react-dropdown

react-dropdown

NPM version Downloads

Simple Dropdown component for React, inspired by react-select

Why

  • The default HTML select element is hard to style
  • And sometime we also want grouped menus
  • if you want more advanced select, check react-select

Installation

// with npm
$ npm install react-dropdown  --save

// with yarn
$ yarn add react-dropdown

Changelog

If you want to support React version under v0.13, use react-dropdown@v0.6.1

Usage

This is the basic usage of react-dropdown

import Dropdown from 'react-dropdown';
import 'react-dropdown/style.css';

const options = [
  'one', 'two', 'three'
];
const defaultOption = options[0];
<Dropdown options={options} onChange={this._onSelect} value={defaultOption} placeholder="Select an option" />;

Options

Flat Array options


const options = [
  'one', 'two', 'three'
];

Object Array options


const options = [
  { value: 'one', label: 'One' },
  { value: 'two', label: 'Two', className: 'myOptionClassName' },
  {
   type: 'group', name: 'group1', items: [
     { value: 'three', label: 'Three', className: 'myOptionClassName' },
     { value: 'four', label: 'Four' }
   ]
  },
  {
   type: 'group', name: 'group2', items: [
     { value: 'five', label: 'Five' },
     { value: 'six', label: 'Six' }
   ]
  }
];

When using Object options you can add to each option a className string to further customize the dropdown, e.g. adding icons to options

Disabling the Dropdown

Just pass a disabled boolean value to the Dropdown to disable it. This will also give you a .Dropdown-disabled class on the element, so you can style it yourself.

<Dropdown disabled onChange={this._onSelect} value={defaultOption} placeholder="Select an option" />;

Customizing the dropdown

className

The className prop is passed down to the wrapper div, which also has the Dropdown-root class.

<Dropdown className='myClassName' />;

controlClassName

The controlClassName prop is passed down to the control div, which also has the Dropdown-control class.

<Dropdown controlClassName='myControlClassName' />;

placeholderClassName

The placeholderClassName prop is passed down to the placeholder div, which also has the Dropdown-placeholder class.

<Dropdown placeholderClassName='myPlaceholderClassName' />;

menuClassName

The menuClassName prop is passed down to the menu div (the one that opens and closes and holds the options), which also has the Dropdown-menu class.

<Dropdown menuClassName='myMenuClassName' />;

arrowClassName

The arrowClassName prop is passed down to the arrow span , which also has the Dropdown-arrow class.

<Dropdown arrowClassName='myArrowClassName' />;

arrowClosed, arrowOpen

The arrowClosed & arrowOpen props enable passing in custom elements for the open/closed state arrows.

<Dropdown
  arrowClosed={<span className="arrow-closed" />}
  arrowOpen={<span className="arrow-open" />}
/>;

Check more examples in the example folder.

Run example

$ npm start

License

MIT | Build for CSViz project @Wiredcraft