Select API
The API documentation of the Select React component. Learn more about the props and the CSS customization points.
Import
import Select from '@material-ui/core/Select';
// or
import { Select } from '@material-ui/core';You can learn more about the difference by reading this guide.
Component name
The MuiSelect name can be used for providing default props or style overrides at the theme level.
Props
| Name | Type | Default | Description | 
|---|---|---|---|
| autoWidth | bool | false | 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. | 
| children | node | The option elements to populate the select with. Can be some MenuItemwhennativeis false andoptionwhennativeis true.⚠️The MenuItemelements must be direct descendants whennativeis false. | |
| classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
| defaultValue | any | The default element value. Use when the component is not controlled. | |
| displayEmpty | bool | false | 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 renderValueprop 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. | 
| IconComponent | elementType | ArrowDropDownIcon | The icon that displays the arrow. | 
| id | string | The idof the wrapper element or theselectelement whennative. | |
| input | element | An Inputelement; does not have to be a material-ui specificInput. | |
| inputProps | object | Attributes applied to the inputelement. Whennativeistrue, the attributes are applied on theselectelement. | |
| label | node | See OutlinedInput#label | |
| labelId | string | The ID of an element that acts as an additional label. The Select will be labelled by the additional label and the selected value. | |
| labelWidth | number | 0 | See OutlinedInput#label | 
| MenuProps | object | Props applied to the Menuelement. | |
| multiple | bool | false | If true,valuemust be an array and the menu will support multiple selections. | 
| native | bool | false | If true, the component uses a nativeselectelement. | 
| onChange | func | Callback fired when a menu item is selected. Signature: function(event: object, child?: object) => voidevent: The event source of the callback. You can pull out the new value by accessing event.target.value(any).child: The react element that was selected when nativeisfalse(default). | |
| onClose | func | Callback fired when the component requests to be closed. Use in controlled mode (see open). Signature: function(event: object) => voidevent: The event source of the callback. | |
| onOpen | func | Callback fired when the component requests to be opened. Use in controlled mode (see open). Signature: function(event: object) => voidevent: The event source of the callback. | |
| open | bool | Control selectopen state. You can only use it when thenativeprop isfalse(default). | |
| renderValue | func | Render the selected value. You can only use it when the nativeprop isfalse(default).Signature: function(value: any) => ReactNodevalue: The valueprovided to the component. | |
| SelectDisplayProps | object | Props applied to the clickable div element. | |
| value | any | The inputvalue. Providing an empty string will select no options. This prop is required when thenativeprop isfalse(default). 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. | |
| variant | 'filled' | 'outlined' | 'standard' | 'standard' | The variant to use. | 
The ref is forwarded to the root element.
Any other props supplied will be provided to the root element (Input).
CSS
| Rule name | Global class | Description | 
|---|---|---|
| root | .MuiSelect-root | Styles applied to the select component rootclass. | 
| select | .MuiSelect-select | Styles applied to the select component selectclass. | 
| filled | .MuiSelect-filled | Styles applied to the select component if variant="filled". | 
| outlined | .MuiSelect-outlined | Styles applied to the select component if variant="outlined". | 
| selectMenu | .MuiSelect-selectMenu | Styles applied to the select component selectMenuclass. | 
| disabled | .Mui-disabled | Pseudo-class applied to the select component disabledclass. | 
| icon | .MuiSelect-icon | Styles applied to the icon component. | 
| iconOpen | .MuiSelect-iconOpen | Styles applied to the icon component if the popup is open. | 
| iconFilled | .MuiSelect-iconFilled | Styles applied to the icon component if variant="filled". | 
| iconOutlined | .MuiSelect-iconOutlined | Styles applied to the icon component if variant="outlined". | 
| nativeInput | .MuiSelect-nativeInput | Styles applied to the underlying native input component. | 
You can override the style of the component thanks to one of these customization points:
- With a rule name of the classesobject prop.
- With a global class name.
- With a theme and an overridesproperty.
If that's not sufficient, you can check the implementation of the component for more detail.
Inheritance
The props of the Input component are also available. You can take advantage of this behavior to target nested components.