Edit page

Select

Select allows users to choose one option from a prescribed list.

Import Syntax

Basic Usage

Alternate Styles

fullWidth
FormControlLabel
appendToBody
menuStyle={{maxHeight: 'none'}}

Controlled Select

selectedItem={this.state.selectedValue}
selectedItem={this.state.selectedItem}

Filterable

Filterable autoSelect

Minimal

Virtualized

with Formik

{
  "state": ""
}

Ridiculous Example

Props

PropertyTypeRequiredDefaultDescription
placeholderStringfalseSelect...Placeholder text for the input.
placementEnumfalsebottom-startSpecify where the menu should appear in relation to the Select element.
virtualizedRowHeightUnionfalse42(virtualized only) Row height used to calculate how many rows to render in a virtualized menu.
onChangeFuncfalse() => {}Callback function fired when the value of the Select changes.
childrenNodefalse-Nodes to be used as options in the Select.
filterableBoolfalse-Toggle the Select to use an input and allow filtering of the items.
autoSelectBoolfalse-The highlighted item will be automatically selected on blur.
virtualizedBoolfalse-Use react-virtualized to render rows as the user scrolls.
selectedItemNodefalse-The selected item of the Select.
selectedValueAnyfalse-Value of the selected item.
renderValueFuncfalse-Function to run when determining how to display selected values in a collapsed Select.
fullWidthBoolfalse-Whether or not the Select will fill its container's width.
minimalBoolfalse-A style variant for Select inputs.
idStringfalse-HTML prop for the Select; works together with a label's `for` prop.
menuStyleObjectfalse-Style prop applied to the menu wrapper.
positionFixedBoolfalse-Uses `position: fixed` on the tooltip, allowing it to show up outside of containers that have `overflow: hidden`.
virtualizedMenuWidthNumberfalse-(virtualized only) Width of the menu; unloaded rows may be wider than the initial set.
popperModifiersObjectfalse-Modifiers to be passed to the Popper element

Notes

For keyboard interaction, Select menus can be opened and selected from using the Spacebaror the Enter keys. The Enter key does not trigger form submission when a Select is in focus. When using a filterable Select, the menu can be opened with the Down Arrow key. A Select can be closed without altering its value with the Escape key.