Button group
ExpressiveGroups buttons as a unit; the connected variant replaces segmented buttons.
import { ButtonGroup } from '@windmorph/react';Purpose
A button group lays out a set of related Button and IconButton children as a unit, sharing their size, shape and variant. The connected variant, with single or multiple selection, is the M3 Expressive replacement for segmented buttons.
Use a standard group for a row of independent actions, and a connected group for choosing between mutually related options.
Usage
- Avoid standard icon buttons and text buttons in a group: they have no container, so the group has nothing to shape. In development the group warns about them.
- A connected group is for selection: fill it with toggle buttons. A connected group with no toggles warns in development; use a standard group for actions.
- Groups don't wrap. When a row of actions can get narrow, turn on
overflow: the trailing buttons fold into a menu at the end of the group and come back as it widens. Put the actions in order of importance, since the last ones fold first.
When not to use
For a single action use a Button; for a primary action with a related menu use a Split button.
See also
- Button group on m3.material.io: Material's own guidelines, with anatomy and specs.
- Button: Five variants and five sizes for text actions, with a toggle form and a press morph.
- Split button: A primary action beside a trailing button that opens a menu of related actions.