Skip to content

ButtonGroup API

The API documentation of the ButtonGroup React component. Learn more about the properties and the CSS customization points.

import ButtonGroup from '@material-ui/core/ButtonGroup';

Props

Name Type Default Description
children * node The content of the button group.
classes object Override or extend the styles applied to the component. See CSS API below for more details.
color enum: 'default' |
 'inherit' |
 'primary' |
 'secondary'
'default' The color of the component. It supports those theme colors that make sense for this component.
component elementType 'div' The component used for the root node. Either a string to use a DOM element or a component.
disabled bool false If true, the buttons will be disabled.
disableFocusRipple bool false If true, the button keyboard focus ripple will be disabled. disableRipple must also be true.
disableRipple bool false If true, the button ripple effect will be disabled.
fullWidth bool false If true, the buttons will take up the full width of its container.
size enum: 'small' |
 'medium' |
 'large'
'medium' The size of the button. small is equivalent to the dense button styling.
variant enum: 'outlined' |
 'contained'
'outlined' The variant to use.

The ref is forwarded to the root element.

Any other properties supplied will be provided to the root element (native element).

CSS

You can override all the class names injected by Material-UI thanks to the classes prop. This prop accepts the following keys:

Name Description
root Styles applied to the root element.
contained Styles applied to the root element if variant="contained".
fullWidth Styles applied to the root element if fullWidth={true}.
grouped Styles applied to the children.
groupedOutlined Styles applied to the children if variant="outlined".
groupedOutlinedPrimary Styles applied to the children if variant="outlined" & color="primary".
groupedOutlinedSecondary Styles applied to the children if variant="outlined" & color="secondary".
groupedContained Styles applied to the children if variant="contained".
groupedContainedPrimary Styles applied to the children if variant="contained" & color="primary".
groupedContainedSecondary Styles applied to the children if variant="contained" & color="secondary".

Have a look at the overriding styles with classes section and the implementation of the component for more detail.

If using the overrides key of the theme, you need to use the following style sheet name: MuiButtonGroup.

Notes

The component is fully StrictMode compatible.

Demos