Skip to content

Unstyled Select

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

useOption API

Import

import useOption from '@mui/base/useOption';
// or
import { useOption } from '@mui/base';
You can learn about the difference by reading this guide on minimizing bundle size.

Parameters

NameTypeDescription
disabled*boolean
label*string | React.ReactNode
value*Value
idstring
optionRefReact.Ref<HTMLElement>

Return value

NameTypeDescription
getRootProps<Other extends EventHandlers>(otherHandlers?: Other) => UseOptionRootSlotProps<Other>
highlightedboolean
indexnumber
refReact.RefCallback<HTMLElement>
selectedboolean


useSelect API

Import

import useSelect from '@mui/base/useSelect';
// or
import { useSelect } from '@mui/base';
You can learn about the difference by reading this guide on minimizing bundle size.

Parameters

NameTypeDescription

Return value

NameTypeDescription
buttonActiveboolean
If true, the trigger button is active (pressed).
buttonFocusVisibleboolean
If true, the trigger button has a visible focus.
contextValueSelectProviderValue<Value>
A value to be passed to the SelectProvider component.
disabledboolean
If true, the select is disabled.
dispatch(action: ListAction<Value> | SelectAction) => void
Action dispatcher for the select component. Allows to programmatically control the select.
getButtonProps<OtherHandlers extends EventHandlers = {}>(otherHandlers?: OtherHandlers) => UseSelectButtonSlotProps<OtherHandlers>
Resolver for the button slot's props.
getListboxProps<OtherHandlers extends EventHandlers = {}>(otherHandlers?: OtherHandlers) => UseSelectListboxSlotProps<OtherHandlers>
Resolver for the listbox slot's props.
getOptionMetadata(optionValue: Value) => SelectOption<Value> | undefined
A function that returns the metadata of an option with a given value.
highlightedOptionValue | null
The value of the highlighted option.
openboolean
If true, the listbox is open.
optionsValue[]
Values of all the registered options.
valueSelectValue<Value, Multiple>
The value of the selected option(s).