Select API
Demos
For examples and details on the usage of this React component, visit the component demo pages:
Import
import Select from '@mui/joy/Select';
// or
import { Select } from '@mui/joy';Props
A ref for imperative actions. It currently only supports focusVisible() action.
Type:
func | { current?: { focusVisible: func } }The color of the component. It supports those theme colors that make sense for this component.
Type:
'danger' | 'info' | 'neutral' | 'primary' | 'success' | 'warning' | stringThe component used for the root node. Either a string to use a HTML element or a component.
Type:
elementTypeA 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:
funcid attribute of the listbox element. Also used to derive the id attributes of options.
Type:
stringName 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:
stringCallback fired when the component requests to be opened. Use in controlled mode (see listboxOpen).
Type:
funcThe components used for each slot inside.
Type:
{ button?: elementType, endDecorator?: elementType, indicator?: elementType, listbox?: elementType, root?: elementType, startDecorator?: elementType }The system prop that allows defining system overrides as well as additional CSS styles.
Type:
Array<func | object | bool> | func | objectref is forwarded to the root element.Theme default props
You can useJoySelect to change the default props of this component with the theme.Slots
To learn how to customize the slot, check out the Overriding component structure guide.
Global class: .MuiSelect-button
Description: The component that renders the button.
Global class: .MuiSelect-startDecorator
Description: The component that renders the start decorator.
Global class: .MuiSelect-endDecorator
Description: The component that renders the end decorator.
Global class: .MuiSelect-indicator
Description: The component that renders the indicator.
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
styleOverridesproperty in a custom theme.
CSS classes
These class names are useful for styling with CSS. They are applied to the root slot when specific states are triggered.
State class applied to the SelectBase root slot if the button is keyboard focused.