Skip to content
+

Select

The Select components let you create lists of options for users to choose from.

  • Feedback
  • Bundle size
  • WAI-ARIA
Component demosComponents APIHooks API

Option API

Import

import { Option } from '@mui/base/Option';
// or
import { Option } from '@mui/base';
Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

valueRequired

The value of the option.

Type:any


disabled

If true, the option will be disabled.

Type:bool

Default:false


label

A text representation of the option's content. Used for keyboard text navigation matching.

Type:string


slotProps

The props used for each slot inside the Option.

Type:{ root?: func
| object }

Default:{}


slots

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:{}



The ref is forwarded to the root element.

Slots

To learn how to customize the slot, check out the Overriding component structure guide.

root

The component that renders the root.

Class name: .MuiOption-root

Default component: 'li'


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.Mui-disabledSTATE

State class applied to the root li element if disabled={true}.


.Mui-selectedSTATE

State class applied to the root li element if selected={true}.


.MuiOption-highlighted

State class applied to the root li element if highlighted={true}.


OptionGroup API

Import

import { OptionGroup } from '@mui/base/OptionGroup';
// or
import { OptionGroup } from '@mui/base';
Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

disabled

If true all the options in the group will be disabled.

Type:bool

Default:false


label

The human-readable description of the group.

Type:node


slotProps

The props used for each slot inside the Input.

Type:{ label?: func
| object, list?: func
| object, root?: func
| object }

Default:{}


slots

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:{}



The ref is forwarded to the root element.

Slots

To learn how to customize the slot, check out the Overriding component structure guide.

root

The component that renders the root.

Class name: .MuiOptionGroup-root

Default component: 'li'


label

The component that renders the label.

Class name: .MuiOptionGroup-label

Default component: 'span'


list

The component that renders the list.

Class name: .MuiOptionGroup-list

Default component: 'ul'


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.Mui-disabledSTATE

State class applied to the root li element if disabled={true}.


Select API

Import

import { Select } from '@mui/base/Select';
// or
import { Select } from '@mui/base';
Learn about the difference by reading this guide on minimizing bundle size.

Props

Props of the native component are also available.

areOptionsEqual

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


autoComplete

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


autoFocus

If true, the select element is focused during the first mount

Type:bool

Default:false


defaultListboxOpen

If true, the select will be initially open.

Type:bool

Default:false


defaultValue

The default selected value. Use when the component is not controlled.

Type:any


disabled

If true, the select is disabled.

Type:bool

Default:false


getOptionAsString

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


getSerializedValue

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


listboxId

id attribute of the listbox element.

Type:string


listboxOpen

Controls the open state of the select's listbox.

Type:bool

Default:undefined


multiple

If true, selecting multiple values is allowed. This affects the type of the value, defaultValue, and onChange props.

Type:bool

Default:false


name

Name of the element. For example used by the server to identify the fields in form submits. If the name is provided, the component will render a hidden input element that can be submitted to a server.

Type:string


onChange

Callback fired when an option is selected.

Type:func


onListboxOpenChange

Callback fired when the component requests to be opened. Use in controlled mode (see listboxOpen).

Type:func


placeholder

Text to show when there is no selected value.

Type:node


renderValue

Function that customizes the rendering of the selected value.

Type:func


required

If true, the Select cannot be empty when submitting form.

Type:bool

Default:false


slotProps

The props used for each slot inside the Input.

Type:{ listbox?: func
| object, popper?: func
| object, root?: func
| object }

Default:{}


slots

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, popper?: elementType, root?: elementType }

Default:{}


value

The selected value. Set to null to deselect all options.

Type:any



The ref is forwarded to the root element.

Slots

To learn how to customize the slot, check out the Overriding component structure guide.

root

The component that renders the root.

Class name: .MuiSelect-root

Default component: 'button'


listbox

The component that renders the listbox.

Class name: .MuiSelect-listbox

Default component: 'ul'


popper

The component that renders the popper.

Class name: .MuiSelect-popper

Default component: Popper


CSS classes

These class names are useful for styling with CSS. They are applied to the component's slots when specific states are triggered.

.Mui-activeSTATE

State class applied to the root button element if active={true}.


.Mui-disabledSTATE

State class applied to the root button element and the listbox 'ul' element if disabled={true}.


.Mui-expandedSTATE

State class applied to the root button element if expanded={true}.


.Mui-focusVisibleSTATE

State class applied to the root button element if focusVisible={true}.


Edit this page

Was this page helpful?


RatingSlider

•

Blog

•

Store