This page as markdown: /button-group.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt

ButtonGroup

Status: stable

Buttons joined into one control: a split button (an action beside the chevron that opens its menu) or a short run of related actions. The children stay ordinary Buttons; the group squares their inner corners, collapses bordered seams into one hairline, and draws a seam between filled ones.

Keywords: split button, button group, segmented actions, dropdown button, joined buttons, toolbar

Usage

Use ButtonGroup when one action has close alternatives (Copy page, with Open in… behind a chevron) or a few actions belong together as one object (zoom out, reset, zoom in). Use ToggleGroup for a choice that stays selected, and Tabs to switch views.

Best practices

Props

Name Type Default Description
role string "group" Group semantics, so a screen reader announces the buttons as one set. Pass toolbar when it carries arrow-key navigation of your own.
className string — Layout classes for the group (margins, alignment). The children's look comes from their own variants.
...props ComponentPropsWithRef<"div"> — All native
attributes, including aria-label.

Accessibility

Related

Examples

Split button with a menu

import { Button, ButtonGroup, Icon, Menu, MenuContent, MenuItem, MenuTrigger } from "@sableui/react"

<ButtonGroup aria-label="Page actions"><Button variant="outline" size="sm" iconStart={<Icon name="copy" />} onClick={copy}>Copy page</Button><Menu><MenuTrigger render={<Button variant="outline" size="icon-sm" aria-label="More page actions" />}><Icon name="chevron-down" /></MenuTrigger><MenuContent align="end"><MenuItem icon={<Icon name="file" />} description="View this page as plain text">View as Markdown</MenuItem></MenuContent></Menu></ButtonGroup>

Related actions

import { Button, ButtonGroup, Icon } from "@sableui/react"

<ButtonGroup aria-label="Zoom"><Button variant="secondary" size="icon-sm" aria-label="Zoom out"><Icon name="minus" /></Button><Button variant="secondary" size="sm">100%</Button><Button variant="secondary" size="icon-sm" aria-label="Zoom in"><Icon name="plus" /></Button></ButtonGroup>