--- productId: material-ui title: React Select component components: Select, NativeSelect githubLabel: 'scope: select' materialDesign: https://m2.material.io/components/menus#exposed-dropdown-menu waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/ githubSource: packages/mui-material/src/Select --- # Select

Select components are used for collecting user provided information from a list of options.

{{"component": "@mui/internal-core-docs/ComponentLinkHeader"}} ## Basic select Menus are positioned under their emitting elements, unless they are close to the bottom of the viewport. {{"demo": "BasicSelect.js"}} ## Advanced features The Select component is meant to be interchangeable with a native `` element of the [InputBase](/material-ui/api/input-base/). It extends the [text field components](/material-ui/react-text-field/) subcomponents, either the [OutlinedInput](/material-ui/api/outlined-input/), [Input](/material-ui/api/input/), or [FilledInput](/material-ui/api/filled-input/), depending on the variant selected. It shares the same styles and many of the same props. Refer to the respective component's API page for details. :::warning Unlike input components, the `placeholder` prop is not available in Select. To add a placeholder, refer to the [placeholder](#placeholder) section below. ::: ### Variants {{"demo": "SelectVariants.js"}} :::warning Note that when using FormControl with the outlined variant of the Select, you need to provide a label in two places: in the InputLabel component and in the `label` prop of the Select component (see the above demo). This is needed for the label floating animation to work correctly. ::: ### Labels and helper text Select always needs an accessible name. This can come from an associated visible label, such as an `InputLabel` linked to the `Select` with `labelId` or from adding an `aria-label` prop to the input element props (`inputProps`). If more information is needed, provide a helper text element and link it to the `Select` using `aria-describedby`. {{"demo": "SelectLabels.js"}} ### Auto width {{"demo": "SelectAutoWidth.js"}} ### Small Size {{"demo": "SelectSmall.js"}} ### Other props {{"demo": "SelectOtherProps.js"}} ## Native select As the user experience can be improved on mobile using the native select of the platform, we allow such pattern. {{"demo": "NativeSelectDemo.js"}} ## TextField The `TextField` wrapper component is a complete form control including a label, input and help text. You can find an example with the select mode [in this section](/material-ui/react-text-field/#select). ## Customization Here are some examples of customizing the component. You can learn more about this in the [overrides documentation page](/material-ui/customization/how-to-customize/). The first step is to style the `InputBase` component. Once it's styled, you can either use it directly as a text field or provide it to the select `input` prop to have a `select` field. Notice that the `"standard"` variant is easier to customize, since it does not wrap the contents in a `fieldset`/`legend` markup. {{"demo": "CustomizedSelects.js"}} 🎨 If you are looking for inspiration, you can check [MUI Treasury's customization examples](https://mui-treasury.com/primitive/select). ## Multiple select The `Select` component can handle multiple selections. It's enabled with the `multiple` prop. Like with the single selection, you can pull out the new value by accessing `event.target.value` in the `onChange` callback. It's always an array. ### Default {{"demo": "MultipleSelect.js"}} ### Selection indicators This example demonstrates how icons are used to indicate the selection state of each item in the listbox. {{"demo": "MultipleSelectCheckmarks.js"}} ### Chip {{"demo": "MultipleSelectChip.js"}} ### Placeholder {{"demo": "MultipleSelectPlaceholder.js"}} ### Native {{"demo": "MultipleSelectNative.js"}} ## Controlling the open state You can control the open state of the select with the `open` prop. Alternatively, it is also possible to set the initial (uncontrolled) open state of the component with the `defaultOpen` prop. :::info - A component is **controlled** when it's managed by its parent using props. - A component is **uncontrolled** when it's managed by its own local state. Learn more about controlled and uncontrolled components in the [React documentation](https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components). ::: {{"demo": "ControlledOpenSelect.js"}} ## With a dialog While it's discouraged by the Material Design guidelines, you can use a select inside a dialog. {{"demo": "DialogSelect.js"}} ## Grouping Display categories with the `ListSubheader` component or the native `` element. {{"demo": "GroupedSelect.js"}} ## Accessibility To properly label your `Select` input you need an extra element with an `id` that contains a label. That `id` needs to match the `labelId` of the `Select`, for example: ```jsx Age ``` Alternatively a `TextField` with an `id` and `label` creates the proper markup and ids for you: ```jsx Ten Twenty ``` For a [native select](#native-select), you should mention a label by giving the value of the `id` attribute of the select element to the `InputLabel`'s `htmlFor` attribute: ```jsx Age ```