Skip to content

Button group

hc-button-group connects adjacent hc-button elements into one segmented cluster — split buttons, icon-button rows, pagination-like groups. It is purely presentational: it collapses the shared inner border-radii, overlaps neighbours by 1px so the touching borders read as a single hairline, and rounds only the outer corners. No selected state, no JavaScript.

Each child is a normal .hc-button, so variants, sizes, and data-hx-* attributes all work unchanged. Set the group’s size by setting data-size on each button.

A common use is a compact row of icon actions. Give every icon-only button an accessible name with aria-label.

Pair a primary action with a caret that opens a menu. Keep the two buttons as the group’s only children and place the popover menu outside the group, referenced by id.

data-orientation="vertical" stacks the buttons and collapses the top/bottom shared borders instead.

  • Wrap the cluster in role="group" with an aria-label (or aria-labelledby) describing what the buttons have in common. This is optional but helps assistive tech announce the relationship.
  • Each button is an independent control with its own accessible name — icon-only buttons must carry aria-label.
  • This is not a selection widget. There is no aria-pressed / aria-checked state here; if you need “one of these is active”, reach for hc-toggle-group.
  • Keyboard behaviour is the native button default (Tab to each, Enter / Space to activate) — the group adds no roving tabindex.
Show the generated CSS variables

hc-button-group introduces no tokens of its own; it reuses the button’s corner radius for the outer corners.

--hc-button-radius (the rounded outer corners; inner corners square off)
  • Button — the grouped element.
  • Toggle group — the selectable (one-active) segmented control.
  • Menu — the dropdown for the split-button caret.
  • Pagination — a purpose-built connected page cluster.