Pular para o conteúdo

ButtonGroup API

API documentation for the React ButtonGroup component. Learn about the available props, and the CSS API.

Import

import ButtonGroup from '@material-ui/core/ButtonGroup';
// ou
import { ButtonGroup } from '@material-ui/core';
You can learn about the difference by reading this guide on minimizing bundle size.

Component name

The name MuiButtonGroup can be used when providing default props or style overrides in the theme.

Propriedades

NomeTipoPadrãoDescrição
childrennodeThe content of the component.
classesobjectOverride or extend the styles applied to the component. See CSS API below for more details.
color'inherit'
| 'primary'
| 'secondary'
| string
'primary'The color of the component. It supports those theme colors that make sense for this component.
componentelementTypeThe component used for the root node. Either a string to use a HTML element or a component.
disabledboolfalseIf true, the accordion is displayed in a disabled state.
disableElevationboolfalseIf true, no elevation is used.
disableFocusRippleboolfalseIf true, the button keyboard focus ripple is disabled.
disableRippleboolfalseIf true, the button ripple effect is disabled.
fullWidthboolfalseIf true, the buttons will take up the full width of its container.
orientation'horizontal'
| 'vertical'
'horizontal'The group orientation (layout flow direction).
size'large'
| 'medium'
| 'small'
'medium'The size of the button. small is equivalent to the dense button styling.
sxobject
variant'contained'
| 'outlined'
| 'text'
| string
'outlined'The variant to use.

O ref é encaminhado para o elemento raiz.
Any other props supplied will be provided to the root element (native element).

CSS

Rule nameGlobal classDescrição
root.MuiButtonGroup-rootStyles applied to the root element.
contained.MuiButtonGroup-containedStyles applied to the root element if variant="contained".
outlined.MuiButtonGroup-outlinedStyles applied to the root element if variant="outlined".
text.MuiButtonGroup-textStyles applied to the root element if variant="text".
disableElevation.MuiButtonGroup-disableElevationStyles applied to the root element if disableElevation={true}.
disabled.Mui-disabledPseudo-class applied to the child elements if disabled={true}.
fullWidth.MuiButtonGroup-fullWidthStyles applied to the root element if fullWidth={true}.
vertical.MuiButtonGroup-verticalStyles applied to the root element if orientation="vertical".
grouped.MuiButtonGroup-groupedStyles applied to the children.
groupedHorizontal.MuiButtonGroup-groupedHorizontalStyles applied to the children if orientation="horizontal".
groupedVertical.MuiButtonGroup-groupedVerticalStyles applied to the children if orientation="vertical".
groupedText.MuiButtonGroup-groupedTextStyles applied to the children if variant="text".
groupedTextHorizontal.MuiButtonGroup-groupedTextHorizontalStyles applied to the children if variant="text" and orientation="horizontal".
groupedTextVertical.MuiButtonGroup-groupedTextVerticalStyles applied to the children if variant="text" and orientation="vertical".
groupedTextPrimary.MuiButtonGroup-groupedTextPrimaryStyles applied to the children if variant="text" and color="primary".
groupedTextSecondary.MuiButtonGroup-groupedTextSecondaryStyles applied to the children if variant="text" and color="secondary".
groupedOutlined.MuiButtonGroup-groupedOutlinedStyles applied to the children if variant="outlined".
groupedOutlinedHorizontal.MuiButtonGroup-groupedOutlinedHorizontalStyles applied to the children if variant="outlined" and orientation="horizontal".
groupedOutlinedVertical.MuiButtonGroup-groupedOutlinedVerticalStyles applied to the children if variant="outlined" and orientation="vertical".
groupedOutlinedPrimary.MuiButtonGroup-groupedOutlinedPrimaryStyles applied to the children if variant="outlined" and color="primary".
groupedOutlinedSecondary.MuiButtonGroup-groupedOutlinedSecondaryStyles applied to the children if variant="outlined" and color="secondary".
groupedContained.MuiButtonGroup-groupedContainedStyles applied to the children if variant="contained".
groupedContainedHorizontal.MuiButtonGroup-groupedContainedHorizontalStyles applied to the children if variant="contained" and orientation="horizontal".
groupedContainedVertical.MuiButtonGroup-groupedContainedVerticalStyles applied to the children if variant="contained" and orientation="vertical".
groupedContainedPrimary.MuiButtonGroup-groupedContainedPrimaryStyles applied to the children if variant="contained" and color="primary".
groupedContainedSecondary.MuiButtonGroup-groupedContainedSecondaryStyles applied to the children if variant="contained" and color="secondary".

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

Demos