React Select

A flexible and beautiful Select Input control for ReactJS with multiselect, autocomplete, async and creatable support.

🎉 Feature Highlights
Advanced
Sortable MultiSelect
Custom Filter logic
Replacing builtins
Methods
Action Meta
Portaling
Controlled Props
Accessing Internals
SSR / Universal Rendering
Experimental

Advanced

Sortable MultiSelect

Using the react-sortable-hoc package we can easily allow sorting of MultiSelect values by drag and drop.

Sortable MultiSelect example

Orange
Yellow

Custom Filter logic

While React-Select assumes a standard way of filtering the menu on search, our api allows you to customise that filtering logic in various ways.

createFilter function

React-Select exports a createFilter function that returns a filterOption method. By using this, users can pick and choose bits of the filtration logic to customise, without having to rewrite the logic wholesale.

Below is an example of how you could use the createFilter function to customise filtration logic in react-select.

Custom filterOption with createFilter

Ocean

filterOption

If you really would like to rewrite the filtration logic from the ground up, simply declare a new filterOption function to be passed in as a prop to react-select. For details on the shape of the filterOption prop, please see the proptypes in the api docs here.

Custom filterOption function

Using a custom filter to always display this option on search

Replacing builtins

For a list of builtins that we expose, please see the API docs here.

custom formatGroupLabel function example

Blue

custom getOptionLabel function example

Composing a display label from the label property and rating property in the options object

Vanilla: safe

custom getOptionValue function example

Using id property, instead of value property.

Chihuahua

custom isOptionDisabled function example

Disable all options that do not have a 'safe' rating, via the isOptionsDisabled fn prop

Vanilla

Using the style API to replace `menuBuffer`

Ocean

Methods

These two methods sit as callable methods on the component. They are designed to be accessible to wrapping components.

focus()

Focused the internal control input.

blur()

Blur the internal control input.

Action Meta

React Select exposes a variety of eventListeners to you via props. The onchange function prop now has the following signature. (value: ValueType, action: ActionType) => undefined;

The action argument is a string with the following possible values

  • 'select-option': Selecting an option from the list
  • 'deselect-option': (Multiple) Deselecting an option from the list
  • 'remove-value': (Multiple) Removing a selected option with the remove button
  • 'pop-value': Removing options using backspace
  • 'set-value': Calling setValue from a component without an action
  • 'clear': Removing all selected options with the clear button
  • 'create-option': (Creatable) Creating a new option

By explicitly passing you what type of change event has been fired, we allow you to have more granular control over how the select behaves after an onChange even is fired.

Below is an example of replicating the behaviour supported by the (deprecated) onSelectResetsInput and (deprecated) closeMenuOnSelect props in react-select v1

onSelectResetsInput = false; closeMenuOnSelect = false

Ocean

Portaling

React-select exposes a menuPortalTarget prop, that lets you portal the select menu to a dom node of your choosing. Additionally we expose the menuPortal styles for layering purposes.

Example of Portaling

Controlled Props

Example of controlled MenuIsOpen

Ocean

Accessing Internals

Accessing Internals via ref

Creatable Select

Select...

Async Select

Select...

Select

Purple

SSR / Universal Rendering

React-Select uses Emotion for CSS which has zero-config server rendering. This means that all you need to do to server-render React-Select is call React's renderToString or use a framework like Next.js or Gatsby and it will work.

import { renderToString } from 'react-dom/server'
import App from './App'

const html = renderToString(<App />)

Experimental

Experimental recipes of prop combinations with react-select.

Popout

A popular recipe for using select when there's limited real estate.

When controlShouldRenderValue is disabled, it's recommended to also disable isClearable and backspaceRemovesValue.

Date Picker

Value: Fri Apr 25 2025 12:00:00 GMT+0000 (Coordinated Universal Time)
Today (25th Apr 2025)

This example uses a combination of custom components and functions to make react-select behave like a date picker.

Type a date like "25/8/18", "tomorrow", "next monday", or "6 weeks from now" into the field to get date suggestions.

Copyright © Jed Watson, 2019. MIT Licensed.