Button group

Attaches related buttons into one shape, with shared borders and rounded outer corners, and groups them for assistive technology.

  • vig-button-group
Import
import { ButtonGroup } from '@vigdx/ui/button-group';

Basic

Put vig-button s (or native buttons) inside and name the group with labels.ariaLabel . Bordered variants such as secondary and outlined share their borders.

Toggle buttons

Independent on/off states, such as text styles, are vig-toggle-button s in a group; each reports its state with aria-pressed . The pressed one draws its border on top.

Vertical and icon-only

orientation="vertical" stacks the buttons at full width. Icon-only buttons need an ariaLabel .

Button group, toolbar or select button

  • A button group only attaches buttons: each one stays its own tab stop, with no arrow-key movement.
  • Use a toolbar for a set of controls acting on one piece of content (an editor, a table): one tab stop and arrow keys between the controls. A toolbar can hold button groups, whose buttons then move with the arrow keys too.
  • To pick one value out of a few, use a select button: it is a radio group with a value and form support, which a group of buttons is not.

Customize

The outer corners use --radius-button and the borders come from each button's variant. Inner corners are square and neighbours overlap by one pixel, with logical properties, so the shape mirrors in right-to-left pages.

Styling hooks

Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="button-group"][data-part="root"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.

Scope: [data-scope="button-group"]

ButtonGroup styling hooks
Part Element data-state
root The vig-button-group host ( role="group" ); also carries data-orientation ( horizontal , vertical ). Style the buttons through their own [data-scope="button"] parts. —

Accessibility

  • The host is a role="group", named by labels.ariaLabel. Leave it unnamed when the buttons explain themselves.
  • The focused button is lifted above its neighbours, so its focus ring is drawn in full; it keeps the transparent outline that forced-colors mode turns visible.

API

ButtonGroup

vig-button-group component

Buttons attached into one shape: shared borders, rounded only on the outer corners (--radius-button), in a role="group". It only groups visually and semantically; each button keeps its own tab stop. For one tab stop with arrow keys between the controls, use vig-toolbar (which can hold button groups). For picking one value from a few, use vig-select-button; for independent on/off states, put vig-toggle-buttons in a group.

Example :
<vig-button-group [labels]="{ ariaLabel: 'History' }">
  <vig-button label="Undo" variant="secondary" />
  <vig-button label="Redo" variant="secondary" />
</vig-button-group>
ButtonGroup props
Name Type Default Description
labelsPartial<ButtonGroupLabels>—

Texts (i18n): the group's accessible name.

orientationButtonGroupOrientation'horizontal'

vertical stacks the buttons, full width, with square inner corners.

Are you sure?