Skip to content

ButtonGroup API

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

Component demos

Import

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

Props

Props of the native component are also available.

children

The content of the component.

Type:node


classes

Override or extend the styles applied to the component.

See CSS API below for more details.

Type:object


color

The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide.

Type:'inherit'
| 'primary'
| 'secondary'
| 'error'
| 'info'
| 'success'
| 'warning'
| string

Default:'primary'


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


disableElevation

If true, no elevation is used.

Type:bool

Default:false


disableFocusRipple

If true, the button keyboard focus ripple is disabled.

Type:bool

Default:false


disableRipple

If true, the button ripple effect is disabled.

Type:bool

Default:false


fullWidth

If true, the buttons will take up the full width of its container.

Type:bool

Default:false


orientation

The component orientation (layout flow direction).

Type:'horizontal'
| 'vertical'

Default:'horizontal'


size

The size of the component. small is equivalent to the dense button styling.

Type:'small'
| 'medium'
| 'large'
| string

Default:'medium'


sx

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
| object


variant

The variant to use.

Type:'contained'
| 'outlined'
| 'text'
| string

Default:'outlined'


The ref is forwarded to the root element.

Theme default props

You can use MuiButtonGroup to change the default props of this component with the theme.


CSS

The following class names are useful for styling with CSS (the state classes are marked).
To learn more, visit the component customization page.

.MuiButtonGroup-root

Styles applied to the root element.

Rule name:root


.MuiButtonGroup-contained

Styles applied to the root element if variant="contained".

Rule name:contained


.MuiButtonGroup-outlined

Styles applied to the root element if variant="outlined".

Rule name:outlined


.MuiButtonGroup-text

Styles applied to the root element if variant="text".

Rule name:text


.MuiButtonGroup-disableElevation

Styles applied to the root element if disableElevation={true}.

Rule name:disableElevation


.Mui-disabledSTATE

State class applied to the child elements if disabled={true}.

Rule name:disabled


.MuiButtonGroup-firstButton

Styles applied to the first button in the button group.

Rule name:firstButton


.MuiButtonGroup-fullWidth

Styles applied to the root element if fullWidth={true}.

Rule name:fullWidth


.MuiButtonGroup-vertical

Styles applied to the root element if orientation="vertical".

Rule name:vertical


.MuiButtonGroup-grouped

Styles applied to the children.

Rule name:grouped


.MuiButtonGroup-groupedHorizontal

Styles applied to the children if orientation="horizontal".

Rule name:groupedHorizontal


.MuiButtonGroup-groupedVertical

Styles applied to the children if orientation="vertical".

Rule name:groupedVertical


.MuiButtonGroup-groupedText

Styles applied to the children if variant="text".

Rule name:groupedText


.MuiButtonGroup-groupedTextHorizontal

Styles applied to the children if variant="text" and orientation="horizontal".

Rule name:groupedTextHorizontal


.MuiButtonGroup-groupedTextVertical

Styles applied to the children if variant="text" and orientation="vertical".

Rule name:groupedTextVertical


.MuiButtonGroup-groupedTextPrimary

Styles applied to the children if variant="text" and color="primary".

Rule name:groupedTextPrimary


.MuiButtonGroup-groupedTextSecondary

Styles applied to the children if variant="text" and color="secondary".

Rule name:groupedTextSecondary


.MuiButtonGroup-groupedOutlined

Styles applied to the children if variant="outlined".

Rule name:groupedOutlined


.MuiButtonGroup-groupedOutlinedHorizontal

Styles applied to the children if variant="outlined" and orientation="horizontal".

Rule name:groupedOutlinedHorizontal


.MuiButtonGroup-groupedOutlinedVertical

Styles applied to the children if variant="outlined" and orientation="vertical".

Rule name:groupedOutlinedVertical


.MuiButtonGroup-groupedOutlinedPrimary

Styles applied to the children if variant="outlined" and color="primary".

Rule name:groupedOutlinedPrimary


.MuiButtonGroup-groupedOutlinedSecondary

Styles applied to the children if variant="outlined" and color="secondary".

Rule name:groupedOutlinedSecondary


.MuiButtonGroup-groupedContained

Styles applied to the children if variant="contained".

Rule name:groupedContained


.MuiButtonGroup-groupedContainedHorizontal

Styles applied to the children if variant="contained" and orientation="horizontal".

Rule name:groupedContainedHorizontal


.MuiButtonGroup-groupedContainedVertical

Styles applied to the children if variant="contained" and orientation="vertical".

Rule name:groupedContainedVertical


.MuiButtonGroup-groupedContainedPrimary

Styles applied to the children if variant="contained" and color="primary".

Rule name:groupedContainedPrimary


.MuiButtonGroup-groupedContainedSecondary

Styles applied to the children if variant="contained" and color="secondary".

Rule name:groupedContainedSecondary


.MuiButtonGroup-lastButton

Styles applied to the last button in the button group.

Rule name:lastButton


.MuiButtonGroup-middleButton

Styles applied to buttons in the middle of the button group.

Rule name:middleButton



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