# Button Group [component-header:sl-button-group] Button groups can be used to group related buttons into sections. ```html preview Left Center Right ``` ```jsx react import { SlButton, SlButtonGroup } from '@shoelace-style/shoelace/dist/react'; const App = () => ( Left Center Right ); ``` ## Examples ### Button Sizes All button sizes are supported, but avoid mixing sizes within the same button group. ```html preview Left Center Right

Left Center Right

Left Center Right ``` ```jsx react import { SlButton, SlButtonGroup } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <> Left Center Right

Left Center Right

Left Center Right ); ``` ### Theme Buttons Theme buttons are supported through the button's `type` attribute. ```html preview Left Center Right

Left Center Right

Left Center Right

Left Center Right

Left Center Right ``` ```jsx react import { SlButton, SlButtonGroup } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <> Left Center Right

Left Center Right

Left Center Right

Left Center Right

Left Center Right ); ``` ### Pill Buttons Pill buttons are supported through the button's `pill` attribute. ```html preview Left Center Right

Left Center Right

Left Center Right ``` ```jsx react import { SlButton, SlButtonGroup } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <> Left Center Right

Left Center Right

Left Center Right ); ``` ### Dropdowns in Button Groups Dropdowns can be placed inside button groups as long as the trigger is an `` element. ```html preview Button Button Dropdown Item 1 Item 2 Item 3 ``` ```jsx react import { SlButton, SlButtonGroup, SlDropdown, SlMenu, SlMenuItem } from '@shoelace-style/shoelace/dist/react'; const App = () => ( Button Button Dropdown Item 1 Item 2 Item 3 ); ``` ### Split Buttons Create a split button using a button and a dropdown. ```html preview Save Save Save as… Save all ``` ```jsx react import { SlButton, SlButtonGroup, SlDropdown, SlMenu, SlMenuItem } from '@shoelace-style/shoelace/dist/react'; const App = () => ( Save Save Save as… Save all ); ``` ### Tooltips in Button Groups Buttons can be wrapped in tooltips to provide more detail when the user interacts with them. ```html preview Left Center Right ``` ```jsx react import { SlButton, SlButtonGroup, SlTooltip } from '@shoelace-style/shoelace/dist/react'; const App = () => ( <> Left Center Right ); ``` ### Toolbar Example Create interactive toolbars with button groups. ```html preview
``` ```jsx react import { SlButton, SlButtonGroup, SlIcon, SlTooltip } from '@shoelace-style/shoelace/dist/react'; const css = ` .button-group-toolbar sl-button-group:not(:last-of-type) { margin-right: var(--sl-spacing-x-small); } `; const App = () => ( <>
); ``` [component-metadata:sl-button-group]