NativeSelect API
API reference docs for the React NativeSelect component. Learn about the props, CSS, and other APIs of this exported module.
Demos
Import
import NativeSelect from '@mui/material/NativeSelect';
// or
import { NativeSelect } from '@mui/material';
Learn about the difference by reading this guide on minimizing bundle size.
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 classes 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.
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 select component error class. | |
.MuiNativeSelect-filled | filled | Styles applied to the select component if variant="filled" . |
.MuiNativeSelect-icon | icon | Styles applied to the icon component. |
.MuiNativeSelect-iconFilled | iconFilled | Styles applied to the icon component if variant="filled" . |
.MuiNativeSelect-iconOpen | iconOpen | Styles applied to the icon component if the popup is open. |
.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-multiple | multiple | Styles applied to the select component if multiple={true} . |
.MuiNativeSelect-nativeInput | nativeInput | Styles applied to the underlying native input component. |
.MuiNativeSelect-outlined | outlined | Styles applied to the select component if variant="outlined" . |
.MuiNativeSelect-root | root | Styles applied to the root element. |
.MuiNativeSelect-select | select | Styles applied to the select component select class. |
.MuiNativeSelect-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.
Source code
If you did not find the information in this page, consider having a look at the implementation of the component for more detail.