NativeSelect API
The API documentation of the NativeSelect React component. Learn more about the properties and the CSS customization points.
import NativeSelect from '@material-ui/core/NativeSelect';
An alternative to <Select native />
with a much smaller bundle size footprint.
Props
Name | Type | Default | Description |
---|---|---|---|
children | node | The option elements to populate the select with. Can be some <option> elements. |
|
classes | object | Override or extend the styles applied to the component. See CSS API below for more details. | |
IconComponent | Component | ArrowDropDownIcon | The icon that displays the arrow. |
input | element | <Input /> | An Input element; does not have to be a material-ui specific Input . |
inputProps | object | Attributes applied to the select element. |
|
onChange | func | Callback function fired when a menu item is selected. Signature: function(event: object) => void event: The event source of the callback. You can pull out the new value by accessing event.target.value . |
|
value | union: string | number | bool | arrayOf |
The input value. | |
variant | enum: 'standard' | 'outlined' | 'filled' |
The variant to use. |
Any other properties supplied will be spread to the root element (Input).
CSS
You can override all the class names injected by Material-UI thanks to the classes
property.
This property accepts the following keys:
Name | Description |
---|---|
root | Styles applied to the Input component root class. |
select | Styles applied to the Input component select class. |
filled | Styles applied to the Input component if variant="filled" . |
outlined | Styles applied to the Input component if variant="outlined" . |
selectMenu | Styles applied to the Input component selectMenu class. |
disabled | Styles applied to the Input component disabled class. |
icon | Styles applied to the Input component icon class. |
Have a look at overriding with classes section and the implementation of the component for more detail.
If using the overrides
key of the theme,
you need to use the following style sheet name: MuiNativeSelect
.
Inheritance
The properties of the Input component are also available. You can take advantage of this behavior to target nested components.