Server Component · 0 KB client JS

Button Group

Groups related buttons, shares its styling with every child, 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 direct child Button inherits it. The group hands the props down during server render, so the sharing costs no client JavaScript. 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"NoneShared visual style pushed onto every child Button.
colorSchemeall 15 schemesNoneShared hue pushed onto every child Button.
size"xs" | "sm" | "md" | "lg" | "xl"NoneShared 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.