NativeSelect API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import NativeSelect from '@mui/material/NativeSelect';
// or
import { NativeSelect } from '@mui/material';
An alternative to <Select native />
with a much smaller bundle size footprint.
Props of the Input component are also available.
Name | Type | Default | Description |
---|---|---|---|
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. |
IconComponent | elementType | ArrowDropDownIcon | The icon that displays the arrow. |
input | element | <Input /> | An |
inputProps | object | Attributes applied to the | |
onChange | func | Callback fired when a menu item is selected. Signature: function(event: React.ChangeEvent
| |
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' | The variant to use. |
ref
is forwarded to the root element.Inheritance
While not explicitly documented above, the props of the Input component are also available in NativeSelect. You can take advantage of this to target nested components.
Theme default props
You can use MuiNativeSelect
to change the default props of this component with the theme.
The following class names are useful for styling with CSS (the state classes are marked).
To learn more, visit the component customization page.
Global class | Rule name | Description |
---|---|---|
.MuiNativeSelect-root | root | Styles applied to the root element. |
.MuiNativeSelect-select | select | Styles applied to the select component select class. |
.MuiNativeSelect-multiple | multiple | Styles applied to the select component if multiple={true} . |
.MuiNativeSelect-filled | filled | Styles applied to the select component if variant="filled" . |
.MuiNativeSelect-outlined | outlined | Styles applied to the select component if variant="outlined" . |
.MuiNativeSelect-standard | standard | Styles applied to the select component if variant="standard" . |
.Mui-disabled | disabled | State class applied to the select component disabled class. |
.MuiNativeSelect-icon | icon | Styles applied to the icon component. |
.MuiNativeSelect-iconOpen | iconOpen | Styles applied to the icon component if the popup is open. |
.MuiNativeSelect-iconFilled | iconFilled | Styles applied to the icon component if variant="filled" . |
.MuiNativeSelect-iconOutlined | iconOutlined | Styles applied to the icon component if variant="outlined" . |
.MuiNativeSelect-iconStandard | iconStandard | Styles applied to the icon component if variant="standard" . |
.MuiNativeSelect-nativeInput | nativeInput | Styles applied to the underlying native input component. |
.Mui-error | error | State class applied to the select component error class. |
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.