--- productId: joy-ui title: React Button Group component components: Button, IconButton, ButtonGroup githubLabel: 'component: ButtonGroup' --- # Button Group
The Button Group combines a set of related buttons.
{{"component": "@mui/docs/ComponentLinkHeader"}} ## Introduction The Button Group component combines a set of buttons that have similar or related functionality. {{"demo": "ButtonGroupUsage.js", "hideToolbar": true, "bg": "gradient"}} ## Basics The Button Group component can wrap [`Button`](/joy-ui/react-button/) and [`IconButton`](/joy-ui/react-button/#icon-button). {{"demo": "BasicButtonGroup.js"}} ## Customization ### Variants The Button Group component supports Joy UI's four [global variants](/joy-ui/main-features/global-variants/): `outlined` (default), `solid`, `soft`, and `plain`. The `variant` prop is passed to the buttons, not the Button Group itself. {{"demo": "VariantButtonGroup.js"}} :::info To learn how to add your own variants, check out [Themed components—Extend variants](/joy-ui/customization/themed-components/#extend-variants). Note that you lose the global variants when you add custom variants. ::: ### Sizes The Button Group component comes in three sizes: `sm`, `md` (default), and `lg`. {{"demo": "GroupSizesColors.js"}} :::info To learn how to add custom sizes to the component, check out [Themed components—Extend sizes](/joy-ui/customization/themed-components/#extend-sizes). ::: ### Colors Every palette included in the theme is available via the `color` prop. Play around combining different colors with different variants. {{"demo": "ButtonGroupColors.js"}} ### Disabled Use the `disabled` prop to disable all the buttons. Note that if you explicitly specify the `disabled` prop on the buttons directly, it will override what is used in the Button Group. {{"demo": "DisabledButtonGroup.js"}} ### Spacing Use `spacing` prop to control the gap between buttons. If the `spacing` is set to `0` (by default), the radius of the buttons will be adjusted to form a continuous surface. {{"demo": "SpacingButtonGroup.js"}} :::success The type of value can be: - `string`: any valid CSS length unit, for example `px`, `rem`, `em`, etc. - `number`: will be calculated by `theme.spacing` function. - `array`: the responsive values based on the breakpoints defined in the theme. - `object`: the key must be one of the breakpoints defined in the theme (the defaults are `"xs" | "sm" | "md" | "lg" | "xl")`, and the value is the spacing of type `string` or `number`. ```jsx