Button Group

Groups related buttons, shares their styling via context, and optionally welds them into a segmented control.

Import#

import { ButtonGroup, Button } from "astralis-ui";

Usage#

Set variant, colorScheme, size or disabled once on the group and every child Button inherits it through context — no prop repetition. An explicit prop on a child always wins, which is how the "Publish" button above breaks out of its group's outline style.

Attached#

attached collapses the gap, the inner corner radii, and the doubled-up borders between neighbors, producing a single segmented control. Classic uses: toolbars and pagination.

Orientation#

orientation="vertical" stacks the buttons. It composes with attached for vertical segmented controls.

Spacing#

When not attached, spacing controls the gap between buttons.

none
sm
md
lg

Disabled#

Disabling the group disables every button in it — handy while a form section is pending.

Props#

Button Group renders a div and accepts all its standard attributes.

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Lays the buttons out in a row or a column.
attachedbooleanfalseWelds the buttons into one segmented control: inner radii collapse and adjacent borders merge. spacing is ignored.
spacing"none" | "sm" | "md" | "lg""md"Gap between buttons when not attached.
variant"solid" | "subtle" | "surface" | "outline" | "text" | "link"Shared visual style pushed onto every child Button.
colorScheme"brand" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink"Shared hue pushed onto every child Button.
size"xs" | "sm" | "md" | "lg" | "xl"Shared size pushed onto every child Button.
disabledbooleanfalseDisables every child Button at once.

Accessibility#

  • Renders with role="group" by default; pass a role (e.g. toolbar) and an aria-label to describe the set when the context isn't obvious.
  • Attached icon-only buttons still need individual aria-labels — see the alignment toolbar demo.