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.

Demos

For examples and details on the usage of this React component, visit the component demo pages:

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.

valueRequired

The option value.

Type:

any
children

The content of the component.

Type:

node
color

The color of the component. It supports those theme colors that make sense for this component.

Type:

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

Default:

'neutral'
component

The component used for the root node. Either a string to use a HTML element or a component.

Type:

elementType
disabled

If true, the component is disabled.

Type:

bool

Default:

false
label

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

Type:

element | string
slotProps

The props used for each slot inside.

Type:

{ root?: func | object }

Default:

{}
slots

The components used for each slot inside.

Type:

{ root?: elementType }

Default:

{}
sx

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

Type:

Array<func | object | bool> | func | object
variant

The global variant to use.

Type:

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

Default:

'plain'

The component cannot hold a ref.

Slots

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

root'li'Required

Global class: .MuiOption-root

Description: The component that renders the root.

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


CSS classes

These class names are useful for styling with CSS. They are applied to the root slot when specific states are triggered.

.Mui-disabledSTATE

State class applied to the root element if disabled={true}.

.Mui-selectedSTATE

State class applied to the root element if the option is selected.

.MuiOption-colorContext

Class name applied to the root element if color="context".

.MuiOption-colorDanger

Class name applied to the root element if color="danger".

.MuiOption-colorNeutral

Class name applied to the root element if color="neutral".

.MuiOption-colorPrimary

Class name applied to the root element if color="primary".

.MuiOption-colorSuccess

Class name applied to the root element if color="success".

.MuiOption-colorWarning

Class name applied to the root element if color="warning".

.MuiOption-highlighted

State class applied to the root element if the option is highlighted.

.MuiOption-variantOutlined

State class applied to the root element if variant="outlined".

.MuiOption-variantPlain

State class applied to the root element if variant="plain".

.MuiOption-variantSoft

State class applied to the root element if variant="soft".

.MuiOption-variantSolid

State class applied to the root element if variant="solid".