ButtonGroup

Groups related Button immediate children into a visually joined cluster - adjacent borders collapse and the group's borderRadius rounds only its outer corners (the first/last buttons keep their...

Demos

For usage examples, visit the component demo page: ButtonGroup

Import

import { ButtonGroup } from '@soroush.tech/design-system/ButtonGroup'

Props

PropTypeDefaultDescription
variant'contained' | 'outlined' | 'text''outlined'Visual style for all child buttons.
colorkeyof Theme['palette']'primary'Color palette for all child buttons.
sizekeyof Theme['sizes']'md'Density for all child buttons.
orientation'horizontal' | 'vertical''horizontal'Layout flow direction.
borderRadiuskeyof Theme['radii']'md'Group corner radius - rounds the outer corners only.
disabledbooleanfalseDisables all child buttons.
fullWidthbooleanfalseGroup fills its container; children share the width.
asElementType'div'Overrides the root element.

Also supports space props on the root.

Notes

  • Renders role="group" - always provide aria-label or aria-labelledby.
  • Separation between adjacent buttons is variant-aware: outlined hides the trailing button's leading edge (keeping its width) so the -thin overlap shows a single, un-doubled border, while contained and text draw a divider there instead (the color's dark shade for contained, a translucent main for text).
  • Children must be immediate Buttons (or components that read ButtonGroupContext).
  • This design system's buttons are flat (no elevation), so no shouldDisableElevation prop exists.
  • A split button (a dropdown-driven action) isn't built in yet: a Menu wraps its trigger in a box of its own, which the group can't join to its buttons.

Source code

If this page does not answer your question, have a look at the implementation of the component for more detail.