Select
The Select components let you create lists of options for users to choose from.
Option API
Import
import { Option } from '@mui/base/Option';
// or
import { Option } from '@mui/base';
Props of the native component are also available.
A text representation of the option's content. Used for keyboard text navigation matching.
Type:string
The components used for each slot inside the Option. Either a string to use a HTML element or a component.
See Slots API below for more details.
Type:{ root?: elementType }
Default:{}
ref
is forwarded to the root element.To learn how to customize the slot, check out the Overriding component structure guide.
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
OptionGroup API
Import
import { OptionGroup } from '@mui/base/OptionGroup';
// or
import { OptionGroup } from '@mui/base';
Props of the native component are also available.
The props used for each slot inside the Input.
Type:{ label?: func
| object, list?: func
| object, root?: func
| object }
Default:{}
The components used for each slot inside the OptionGroup. Either a string to use a HTML element or a component.
See Slots API below for more details.
Type:{ label?: elementType, list?: elementType, root?: elementType }
Default:{}
ref
is forwarded to the root element.To learn how to customize the slot, check out the Overriding component structure guide.
The component that renders the label.
Class name: .base-OptionGroup-label
Default component: 'span'
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
Select API
Import
import { Select } from '@mui/base/Select';
// or
import { Select } from '@mui/base';
Props of the native component are also available.
A function used to determine if two options' values are equal. By default, reference equality is used.
There is a performance impact when using the areOptionsEqual
prop (proportional to the number of options). Therefore, it's recommented to use the default reference equality comparison whenever possible.
Type:func
This prop helps users to fill forms faster, especially on mobile devices. The name can be confusing, as it's more like an autofill. You can learn more about it following the specification.
Type:string
A function used to convert the option label to a string. It's useful when labels are elements and need to be converted to plain text to enable navigation using character keys on a keyboard.
Type:func
Default:defaultOptionStringifier
A function to convert the currently selected value to a string. Used to set a value of a hidden input associated with the select, so that the selected value can be posted with a form.
Type:func
If true
, selecting multiple values is allowed. This affects the type of the value
, defaultValue
, and onChange
props.
Type:bool
Default:false
Name of the element. For example used by the server to identify the fields in form submits.
Type:string
Callback fired when the component requests to be opened. Use in controlled mode (see listboxOpen).
Type:func
The props used for each slot inside the Input.
Type:{ listbox?: func
| object, popup?: func
| object, root?: func
| object }
Default:{}
The components used for each slot inside the Select. Either a string to use a HTML element or a component.
See Slots API below for more details.
Type:{ listbox?: elementType, popup?: elementType, root?: elementType }
Default:{}
ref
is forwarded to the root element.To learn how to customize the slot, check out the Overriding component structure guide.
The component that renders the listbox.
Class name: .base-Select-listbox
Default component: 'ul'
These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.
State class applied to the root button
element and the listbox 'ul' element if disabled={true}
.