Skip to content

Select API

API reference docs for the React Select component. Learn about the props, CSS, and other APIs of this exported module.

Component demos

Import

import Select from '@mui/material/Select';
// or
import { Select } from '@mui/material';
Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the OutlinedInput component are also available.

autoWidth

If true, the width of the popover will automatically be set according to the items inside the menu, otherwise it will be at least the width of the select input.

Type:bool

Default:false


children

The option elements to populate the select with. Can be some MenuItem when native is false and option when native is true.
⚠️The MenuItem elements must be direct descendants when native is false.

Type:node


classes

Override or extend the styles applied to the component.

See CSS API below for more details.

Type:object

Default:{}


defaultOpen

If true, the component is initially open. Use when the component open state is not controlled (i.e. the open prop is not defined). You can only use it when the native prop is false (default).

Type:bool

Default:false


defaultValue

The default value. Use when the component is not controlled.

Type:any


displayEmpty

If true, a value is displayed even if no items are selected.
In order to display a meaningful value, a function can be passed to the renderValue prop which returns the value to be displayed when no items are selected.
⚠️ When using this prop, make sure the label doesn't overlap with the empty displayed value. The label should either be hidden or forced to a shrunk state.

Type:bool

Default:false


IconComponent

The icon that displays the arrow.

Type:elementType

Default:ArrowDropDownIcon


id

The id of the wrapper element or the select element when native.

Type:string


input

An Input element; does not have to be a material-ui specific Input.

Type:element


inputProps

Attributes applied to the input element. When native is true, the attributes are applied on the select element.

Type:object


label

See OutlinedInput#label

Type:node


labelId

The ID of an element that acts as an additional label. The Select will be labelled by the additional label and the selected value.

Type:string


MenuProps

Props applied to the Menu element.

Type:object


multiple

If true, value must be an array and the menu will support multiple selections.

Type:bool

Default:false


native

If true, the component uses a native select element.

Type:bool

Default:false


onChange

Callback fired when a menu item is selected.

Type:func

Signature:
function(event: SelectChangeEvent, child?: object) => void
  • event The event source of the callback. You can pull out the new value by accessing event.target.value (any). Warning: This is a generic event, not a change event, unless the change event is caused by browser autofill.
  • child The react element that was selected when native is false (default).

onClose

Callback fired when the component requests to be closed. Use it in either controlled (see the open prop), or uncontrolled mode (to detect when the Select collapses).

Type:func

Signature:
function(event: object) => void
  • event The event source of the callback.

onOpen

Callback fired when the component requests to be opened. Use it in either controlled (see the open prop), or uncontrolled mode (to detect when the Select expands).

Type:func

Signature:
function(event: object) => void
  • event The event source of the callback.

open

If true, the component is shown. You can only use it when the native prop is false (default).

Type:bool


renderValue

Render the selected value. You can only use it when the native prop is false (default).

Type:func

Signature:
function(value: any) => ReactNode
  • value The value provided to the component.

SelectDisplayProps

Props applied to the clickable div element.

Type:object


sx

The system prop that allows defining system overrides as well as additional CSS styles.

See the `sx` page for more details.

Type:Array<func
| object
| bool>
| func
| object


value

The input value. Providing an empty string will select no options. Set to an empty string '' if you don't want any of the available options to be selected.
If the value is an object it must have reference equality with the option in order to be selected. If the value is not an object, the string representation must match with the string representation of the option in order to be selected.

Type:''
| any


variant

The variant to use.

Type:'filled'
| 'outlined'
| 'standard'

Default:'outlined'


The ref is forwarded to the root element.

Inheritance

While not explicitly documented above, the props of the OutlinedInput component are also available in Select. You can take advantage of this to target nested components.


Theme default props

You can use MuiSelect to change the default props of this component with the theme.


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.Mui-disabledSTATE

State class applied to the select component disabled class.


.Mui-errorSTATE

State class applied to the root element if error={true}.


.MuiSelect-filled

Styles applied to the select component if variant="filled".

Rule name:filled


.MuiSelect-icon

Styles applied to the icon component.

Rule name:icon


.MuiSelect-iconFilled

Styles applied to the icon component if variant="filled".

Rule name:iconFilled


.MuiSelect-iconOpen

Styles applied to the icon component if the popup is open.

Rule name:iconOpen


.MuiSelect-iconOutlined

Styles applied to the icon component if variant="outlined".

Rule name:iconOutlined


.MuiSelect-iconStandard

Styles applied to the icon component if variant="standard".

Rule name:iconStandard


.MuiSelect-multiple

Styles applied to the select component if multiple={true}.

Rule name:multiple


.MuiSelect-nativeInput

Styles applied to the underlying native input component.

Rule name:nativeInput


.MuiSelect-outlined

Styles applied to the select component if variant="outlined".

Rule name:outlined


.MuiSelect-root

Styles applied to the root element.

Rule name:root


.MuiSelect-select

Styles applied to the select component select class.

Rule name:select


.MuiSelect-standard

Styles applied to the select component if variant="standard".

Rule name:standard



You can override the style of the component using one of these customization options: