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';
Props of the OutlinedInput component are also available.
Name | Type | Default | Description |
---|---|---|---|
autoWidth | bool | false | If |
children | node | The option elements to populate the select with. Can be some | |
classes | object | {} | Override or extend the styles applied to the component. See CSS API below for more details. |
defaultOpen | bool | false | If |
defaultValue | any | The default value. Use when the component is not controlled. | |
displayEmpty | bool | false | If |
IconComponent | elementType | ArrowDropDownIcon | The icon that displays the arrow. |
id | string | The | |
input | element | An | |
inputProps | object | Attributes applied to the | |
label | node | ||
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. | |
MenuProps | object | Props applied to the | |
multiple | bool | false | If |
native | bool | false | If |
onChange | func | Callback fired when a menu item is selected. Signature: function(event: SelectChangeEvent
| |
onClose | func | Callback fired when the component requests to be closed. Use it in either controlled (see the Signature: function(event: object) => void
| |
onOpen | func | Callback fired when the component requests to be opened. Use it in either controlled (see the Signature: function(event: object) => void
| |
open | bool | If | |
renderValue | func | Render the selected value. You can only use it when the Signature: function(value: any) => ReactNode
| |
SelectDisplayProps | object | Props applied to the clickable div element. | |
sx | Array<func | object | bool> | func | object | The system prop that allows defining system overrides as well as additional CSS styles. See the `sx` page for more details. | |
value | '' | any | The | |
variant | 'filled' | 'outlined' | 'standard' | 'outlined' | The variant to use. |
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.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Class name | Rule name | Description |
---|---|---|
.Mui-disabled | State class applied to the select component disabled class. | |
.Mui-error | State class applied to the root element if error={true} . | |
.MuiSelect-filled | filled | Styles applied to the select component if variant="filled" . |
.MuiSelect-icon | icon | Styles applied to the icon component. |
.MuiSelect-iconFilled | iconFilled | Styles applied to the icon component if variant="filled" . |
.MuiSelect-iconOpen | iconOpen | Styles applied to the icon component if the popup is open. |
.MuiSelect-iconOutlined | iconOutlined | Styles applied to the icon component if variant="outlined" . |
.MuiSelect-iconStandard | iconStandard | Styles applied to the icon component if variant="standard" . |
.MuiSelect-multiple | multiple | Styles applied to the select component if multiple={true} . |
.MuiSelect-nativeInput | nativeInput | Styles applied to the underlying native input component. |
.MuiSelect-outlined | outlined | Styles applied to the select component if variant="outlined" . |
.MuiSelect-root | root | Styles applied to the root element. |
.MuiSelect-select | select | Styles applied to the select component select class. |
.MuiSelect-standard | standard | Styles applied to the select component if variant="standard" . |
You can override the style of the component using one of these customization options:
- With a global class name.
- With a rule name as part of the component's
styleOverrides
property in a custom theme.