react-select vs react-native-picker-select vs react-dropdown vs react-dropdown-select vs react-native-select-dropdown
Dropdown and Select Components for React and React Native
react-selectreact-native-picker-selectreact-dropdownreact-dropdown-selectreact-native-select-dropdownSimilar 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-select6,546,10328,042726 kB4814 months agoMIT
react-native-picker-select128,3201,84345.8 kB102a year agoMIT
react-dropdown77,77267324 kB110-MIT
react-dropdown-select42,584362187 kB296 months agoMIT
react-native-select-dropdown34,60236335.5 kB522 years agoMIT
Feature Comparison: react-select vs react-native-picker-select vs react-dropdown vs react-dropdown-select vs react-native-select-dropdown

Customization

  • 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.

  • 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-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-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.

Multi-Select Support

  • 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.

  • 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-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-select-dropdown:

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

Accessibility

  • 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.

  • 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-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-select-dropdown:

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

Code Example

  • 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;
    
  • 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-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-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;
    
How to Choose: react-select vs react-native-picker-select vs react-dropdown vs react-dropdown-select vs react-native-select-dropdown
  • 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.

  • 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-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-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.

README for react-select

NPM CircleCI Coverage Status Supported by Thinkmill

React-Select

The Select control for React. Initially built for use in KeystoneJS.

See react-select.com for live demos and comprehensive docs.

React Select is funded by Thinkmill and Atlassian. It represents a whole new approach to developing powerful React.js components that just work out of the box, while being extremely customisable.

For the story behind this component, watch Jed's talk at React Conf 2019 - building React Select

Features include:

  • Flexible approach to data, with customisable functions
  • Extensible styling API with emotion
  • Component Injection API for complete control over the UI behaviour
  • Controllable state props and modular architecture
  • Long-requested features like option groups, portal support, animation, and more

Using an older version?

Installation and usage

The easiest way to use react-select is to install it from npm and build it into your app with Webpack.

yarn add react-select

Then use it in your app:

With React Component

import React from 'react';
import Select from 'react-select';

const options = [
  { value: 'chocolate', label: 'Chocolate' },
  { value: 'strawberry', label: 'Strawberry' },
  { value: 'vanilla', label: 'Vanilla' },
];

class App extends React.Component {
  state = {
    selectedOption: null,
  };
  handleChange = (selectedOption) => {
    this.setState({ selectedOption }, () =>
      console.log(`Option selected:`, this.state.selectedOption)
    );
  };
  render() {
    const { selectedOption } = this.state;

    return (
      <Select
        value={selectedOption}
        onChange={this.handleChange}
        options={options}
      />
    );
  }
}

With React Hooks

import React, { useState } from 'react';
import Select from 'react-select';

const options = [
  { value: 'chocolate', label: 'Chocolate' },
  { value: 'strawberry', label: 'Strawberry' },
  { value: 'vanilla', label: 'Vanilla' },
];

export default function App() {
  const [selectedOption, setSelectedOption] = useState(null);

  return (
    <div className="App">
      <Select
        defaultValue={selectedOption}
        onChange={setSelectedOption}
        options={options}
      />
    </div>
  );
}

Props

Common props you may want to specify include:

  • autoFocus - focus the control when it mounts
  • className - apply a className to the control
  • classNamePrefix - apply classNames to inner elements with the given prefix
  • isDisabled - disable the control
  • isMulti - allow the user to select multiple values
  • isSearchable - allow the user to search for matching options
  • name - generate an HTML input with this name, containing the current value
  • onChange - subscribe to change events
  • options - specify the options the user can select from
  • placeholder - change the text displayed when no option is selected
  • noOptionsMessage - ({ inputValue: string }) => string | null - Text to display when there are no options
  • value - control the current value

See the props documentation for complete documentation on the props react-select supports.

Controllable Props

You can control the following props by providing values for them. If you don't, react-select will manage them for you.

  • value / onChange - specify the current value of the control
  • menuIsOpen / onMenuOpen / onMenuClose - control whether the menu is open
  • inputValue / onInputChange - control the value of the search input (changing this will update the available options)

If you don't provide these props, you can set the initial value of the state they control:

  • defaultValue - set the initial value of the control
  • defaultMenuIsOpen - set the initial open value of the menu
  • defaultInputValue - set the initial value of the search input

Methods

React-select exposes two public methods:

  • focus() - focus the control programmatically
  • blur() - blur the control programmatically

Customisation

Check the docs for more information on:

TypeScript

The v5 release represents a rewrite from JavaScript to TypeScript. The types for v4 and earlier releases are available at @types. See the TypeScript guide for how to use the types starting with v5.

Thanks

Thank you to everyone who has contributed to this project. It's been a wild ride.

If you like React Select, you should follow me on twitter!

Shout out to Joss Mackison, Charles Lee, Ben Conolly, Tom Walker, Nathan Bierema, Eric Bonow, Emma Hamilton, Dave Brotherstone, Brian Vaughn, and the Atlassian Design System team who along with many other contributors have made this possible ❤️

License

MIT Licensed. Copyright (c) Jed Watson 2022.