Skip to content

CdsButtonGroup

New in v4.0

A button group joins several CdsButton into one block: the buttons sit flush against each other, only the outer corners stay rounded, and shared props are set once on the group. This is how you present sets of related actions — a toolbar over a record or zoom controls.

Storybook GitLab Figma
Test coverage: 90% — good coverage
API in specs
9 / 10 props, events, slots and exposed members with a test
Test cases
14 unit · 0 browser
Code coverage
100% lines · 100% branches measured in v4.0.0-alpha.13
A11y (axe)
no violations in 1 stories measured in v4.0.0-alpha.11

If the user does not trigger an action but picks one of several options, use CdsButtonToggle — it keeps the selected state.

Variations ​

The group passes the variant, color, base-color and size props down to every button inside — you do not need to repeat them on each button. A prop set on the button itself takes precedence over the group value.

Variant and color ​

variant and color set the look of every button in the group — from a filled solid for the main set of actions to color="inverse" for dark backgrounds. The deprecated appearance still works and resolves into the same pair as on CdsButton.

Sizes ​

size changes the height and padding of all buttons at once, so a group in a filter bar and a group in a table header stay consistent.

Color ​

color paints the button background with a palette alias. Use status colors when the whole group leads to one outcome — accept or reject.

Dividers and direction ​

Without divided the buttons sit flush against each other; with it a line appears between them, so neighboring actions do not blend together. direction="vertical" turns the group into a column — for zoom controls on a map, for example.

API ​

Props

NameTypeDefaultDescription
appearancedeprecated"inverse" | "primary" | "secondary" | "tertiary" | "transparent" | undefined—Visual appearance of the component. Deprecated: use variant and color
baseColorstring | undefined—Color of the component in its inactive state
color(string & {}) | "neutral" | "brand" | "accent" | "danger" | "inverse" | undefined'brand'Component color: a role, a palette alias, a theme token or a CSS color
direction"horizontal" | "vertical" | undefined'horizontal'Switches the component between horizontal and vertical layout.
dividedboolean | undefined—Adds dividers between the buttons of the group.
sizenumber | "xs" | "sm" | "md" | "lg" | "xl" | undefined'md'Size of the component
tagstring | JSXComponent<any> | undefined'div'Custom HTML tag or component to render
themestring | undefined—Component theme
variant"solid" | "soft" | "outline" | "surface" | "ghost" | undefined'solid'Component variant: solid, soft, outline, surface, ghost

Slots

NameTypeDescription
defaultanyButtons of the group.