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.

Demos

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

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

Styles applied to the root element.


.MuiButtonGroup-containedcontained

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


.MuiButtonGroup-outlinedoutlined

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


.MuiButtonGroup-texttext

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


.MuiButtonGroup-disableElevationdisableElevation

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


.Mui-disableddisabledSTATE

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


.MuiButtonGroup-fullWidthfullWidth

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


.MuiButtonGroup-verticalvertical

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


.MuiButtonGroup-groupedgrouped

Styles applied to the children.


.MuiButtonGroup-groupedHorizontalgroupedHorizontal

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


.MuiButtonGroup-groupedVerticalgroupedVertical

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


.MuiButtonGroup-groupedTextgroupedText

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


.MuiButtonGroup-groupedTextHorizontalgroupedTextHorizontal

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


.MuiButtonGroup-groupedTextVerticalgroupedTextVertical

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


.MuiButtonGroup-groupedTextPrimarygroupedTextPrimary

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


.MuiButtonGroup-groupedTextSecondarygroupedTextSecondary

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


.MuiButtonGroup-groupedOutlinedgroupedOutlined

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


.MuiButtonGroup-groupedOutlinedHorizontalgroupedOutlinedHorizontal

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


.MuiButtonGroup-groupedOutlinedVerticalgroupedOutlinedVertical

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


.MuiButtonGroup-groupedOutlinedPrimarygroupedOutlinedPrimary

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


.MuiButtonGroup-groupedOutlinedSecondarygroupedOutlinedSecondary

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


.MuiButtonGroup-groupedContainedgroupedContained

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


.MuiButtonGroup-groupedContainedHorizontalgroupedContainedHorizontal

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


.MuiButtonGroup-groupedContainedVerticalgroupedContainedVertical

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


.MuiButtonGroup-groupedContainedPrimarygroupedContainedPrimary

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


.MuiButtonGroup-groupedContainedSecondarygroupedContainedSecondary

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


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