Skip to content

Option API

API reference docs for the React Option component. Learn about the props, CSS, and other APIs of this exported module.

Component demos

Import

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

Props

Props of the native component are also available.

NameTypeDefaultDescription
value*any-

The option value.

childrennode-

The content of the component.

color'danger'
| 'neutral'
| 'primary'
| 'success'
| 'warning'
| string
'neutral'

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.

disabledboolfalse

If true, the component is disabled.

labelelement
| string
-

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

sxArray<func
| object
| bool>
| func
| object
-

The system prop that allows defining system overrides as well as additional CSS styles.

See the `sx` page for more details.

variant'outlined'
| 'plain'
| 'soft'
| 'solid'
| string
'plain'

The global variant to use.

To learn how to add your own variants, check out Themed components—Extend variants.

The component cannot hold a ref.

Slots

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

Slot nameClass nameDefault componentDescription
root.MuiOption-root'li'The component that renders the root.

CSS classes

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

Class nameRule nameDescription
.Mui-disabledState class applied to the root element if disabled={true}.
.Mui-selectedState class applied to the root element if the option is selected.
.MuiOption-colorContextcolorContextClass name applied to the root element if color="context".
.MuiOption-colorDangercolorDangerClass name applied to the root element if color="danger".
.MuiOption-colorNeutralcolorNeutralClass name applied to the root element if color="neutral".
.MuiOption-colorPrimarycolorPrimaryClass name applied to the root element if color="primary".
.MuiOption-colorSuccesscolorSuccessClass name applied to the root element if color="success".
.MuiOption-colorWarningcolorWarningClass name applied to the root element if color="warning".
.MuiOption-highlightedhighlightedState class applied to the root element if the option is highlighted.
.MuiOption-variantOutlinedvariantOutlinedState class applied to the root element if variant="outlined".
.MuiOption-variantPlainvariantPlainState class applied to the root element if variant="plain".
.MuiOption-variantSoftvariantSoftState class applied to the root element if variant="soft".
.MuiOption-variantSolidvariantSolidState class applied to the root element if variant="solid".

You can override the style of the component using one of these customization options: