0 Tk

button-group

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 of the native component are also available.

Name Type Default Description
children node - The content of the component.
classes object - Override or extend the styles applied to the component. See CSS classes API below for more details.
color ‘inherit’ | ‘primary’ | ‘secondary’ | ‘error’ | ‘info’ | ‘success’ | ‘warning’ | string ‘primary’ The color of the component. It supports both default and custom theme colors, which can be added as shown in the palette customization guide.
component elementType - The component used for the root node. Either a string to use a HTML element or a component.
disabled bool false If true, the component is disabled.
disableElevation bool false If true, no elevation is used.
disableFocusRipple bool false If true, the button keyboard focus ripple is disabled.
disableRipple bool false If true, the button ripple effect is disabled.
fullWidth bool false If true, the buttons will take up the full width of its container.
orientation ‘horizontal’ | ‘vertical’ ‘horizontal’ The component orientation (layout flow direction).
size ‘small’ | ‘medium’ | ‘large’ | string ‘medium’ The size of the component. small is equivalent to the dense button styling.
sx Array<func | object | bool> | func | object - The system prop that allows defining system overrides as well as additional CSS styles. See the sx page for more details.
variant ‘contained’ | ‘outlined’ | ‘text’ | string ‘outlined’ The variant to use.

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.

These class names are useful for styling with CSS. They are applied to the component’s slots when specific states are triggered.

Class name Rule name Description
.Mui-disabled - State class applied to the child elements if disabled={true}.
.MuiButtonGroup-colorPrimary colorPrimary Styles applied to the root element if color="primary"
.MuiButtonGroup-colorSecondary colorSecondary Styles applied to the root element if color="secondary"
… (rest of the class names remain the same)

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

Source code

If you did not find the information in this page, consider having a look at the implementation of the component for more detail.