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.
To learn how to add your own colors, check out Themed components—Extend colors.
Type:
'danger' | '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 size of the component.
To learn how to add custom sizes to the component, check out Themed components—Extend sizes.
Type:
'sm' | 'md' | 'lg' | stringThe components used for each slot inside.
See Slots API below for more details.
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.
See the `sx` page for more details.
Type:
Array<func | object | bool> | func | objectThe global variant to use.
To learn how to add your own variants, check out Themed components—Extend variants.
Type:
'outlined' | 'plain' | 'soft' | 'solid' | stringref is forwarded to the root element.Theme default props
You can use JoySelect 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.
The component that renders the button.
Default: 'button'
Global class: .MuiSelect-button
The component that renders the start decorator.
Default: 'span'
Global class: .MuiSelect-startDecorator
The component that renders the end decorator.
Default: 'span'
Global class: .MuiSelect-endDecorator
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.