Select

Select gives users the ability to make a single selection, or multiple selections from a number of options.

Select

When to use

A dropdown menu for displaying choices - an elegant alternative to the native <select> element. Utilizing Radio is recommended when there are fewer total options (less than 5).



Basic usage

Allows the user to select a single item from a dropdown menu.
Item 2
Caption

Select with search field

Search the options while expanded

Multiple selection

Allows the user to select a multiple items from a dropdown menu.

Custom selection render

Spacified the prop name of Option which will be rendered in select box

Tags

Select with tags, transform input to tag (scroll the menu)

Option group

Options in a Select can be grouped together.
Item 2

Coordinate

Coordinating the selection of provinces and cities is a common use case and demonstrates how selection can be coordinated.
Using the Cascader component is strongly recommended instead as it is more flexible and capable.
Zhejiang
Hangzhou

Automatic tokenization

Try to copy Item 1, Item 2 to the input. Only available in tags and multiple mode.

Custom dropdown

Customize the dropdown menu via dropdownRender.
Custom dropdown render

API

Select props
PropertyDescriptionTypeDefault
allowClear
Show clear button.
boolean
false
autoClearSearchValue
Whether the current search will be cleared on selecting an item. Only applies when mode is set to multiple or tags.
boolean
true
autoFocus
Get focus by default
boolean
false
defaultActiveFirstOption
Whether active first option by default
boolean
boolean
defaultValue
Initial selected option.
LabeledValue|LabeledValue[]
-
disabled
Whether disabled select
boolean
false
dropdownClassName
className of dropdown menu
string
-
dropdownMatchSelectWidth
Determine whether the dropdown menu and the select input are the same width. Default set min-width same as input. false will disable virtual scroll
boolean | number
true
dropdownRender
Customize dropdown content
(originNode: ReactNode) => ReactNode
-
dropdownStyle
style of dropdown menu
CSSProperties
-
filterOption
If true, filter options by input, if function, filter options against it. The function will receive two arguments, inputValue and option, if the function returns true, the option will be included in the filtered set; Otherwise, it will be excluded.
boolean or function(inputValue, option)
true
getPopupContainer
Parent Node which the selector should be rendered to. Default to body. When position issues happen, try to modify it into scrollable content and position it relative. Example
function(triggerNode)
() => document.body
labelInValue
whether to embed label in value, turn the format of value from string to {key: string, label: ReactNode}
boolean
false
listHeight
Config popup height
number
256
maxTagCount
Max tag count to show
number
-
maxTagTextLength
Max tag text length to show
number
-
maxTagPlaceholder
Placeholder for not showing tags
ReactNode/function(omittedValues)
-
tagRender
Customize tag render
(props) => ReactNode
-
mode
Set mode of Select
multiple | tags
-
notFoundContent
Specify content to show when no result matches..
ReactNode
'Not Found'
options
Select options. Will get better perf than jsx definition
{ label, value }[]
-
optionFilterProp
Which prop value of option will be used for filter if filterOption is true
string
value
optionLabelProp
Which prop value of option will render as content of select. Example
string
children
placeholder
Placeholder of select
string|ReactNode
-
showArrow
Whether to show the drop-down arrow
boolean
true
showSearch
Whether show search input in single mode.
boolean
false
size
Size of Select input.
large | middle | small
suffixIcon
The custom suffix icon
ReactNode
-
removeIcon
The custom remove icon
ReactNode
-
clearIcon
The custom clear icon
ReactNode
-
menuItemSelectedIcon
The custom menuItemSelected icon with multiple options
ReactNode
-
tokenSeparators
Separator used to tokenize on tag/multiple mode
string[]
value
Current selected option.
string|string[] number|number[] LabeledValue|LabeledValue[]
-
virtual
Disable virtual scroll when set to false
boolean
true
onBlur
Called when blur
function
-
onChange
Called when select an option or input value change
function(value, option:Option/Array
-
onDeselect
Called when a option is deselected, param is the selected option's value. Only called for multiple or tags, effective in multiple or tags mode only.
function(string|number|LabeledValue)
-
onFocus
Called when focus
function
-
onInputKeyDown
Called when key pressed
function
-
onMouseEnter
Called when mouse enter
function
-
onMouseLeave
Called when mouse leave
function
-
onPopupScroll
Called when dropdown scrolls
function
-
onSearch
Callback function that is fired when input changed.
function(value: string)
onSelect
Called when a option is selected, the params are option's value (or key) and option instance.
function(string|number|LabeledValue, option:Option)
-
defaultOpen
Initial open state of dropdown
boolean
-
open
Controlled open state of dropdown
boolean
-
onDropdownVisibleChange
Call when dropdown open
function(open)
-
loading
indicate loading state
Boolean
false
bordered
whether has border style
Boolean
true
Select Methods
NameDescriptionVersion
blur()
Remove focus
focus()
Get focus
Option props
PropertyDescriptionTypeDefault
disabled
Disable this option
boolean
false
title
title of Select after select this Option
string
-
value
default to filter with this property
string|number
-
className
additional class to option
string
-
OptGroup props
PropertyDescriptionTypeDefault
key
string
-
label
Group label
string|React.Element
-