Skip to content
Nana UI

Button Group

View .md Download

Groups related nana-button elements into a single visual unit — joined together (the default) or evenly spaced. Optionally propagates a shared size and variant to every button so they stay consistent.

Left Middle Right
Terminal window
npm install @nana-tec/ui-components
import "@nana-tec/ui-components/button-group";
<nana-button-group>
<nana-button>Left</nana-button>
<nana-button>Middle</nana-button>
<nana-button>Right</nana-button>
</nana-button-group>

Properties

PropertyAttributeTypeDefaultDescription
ariaLabelaria-labelstring | nullnullAccessible label for the group (maps to `aria-label`)
orientationButtonGroupOrientation'horizontal'Lay the buttons out in a row or a column
separatedbooleanfalseSpace the buttons apart instead of joining them into one seamless unit
sizeSize | undefinedWhen set, applied to every slotted button so they share one size
variantVariant | undefinedWhen set, applied to every slotted button so they share one variant

Slots

SlotDescription
(default)One or more `nana-button` elements

CSS parts

PartDescription
::part(base)The group container

CSS custom properties

PropertyDescription
--nana-button-group-radiusCorner radius of the joined group
SlotDescription
(default)One or more nana-button elements
VariableDefaultDescription
--nana-button-group-radiusCorner radius of the joined group
PartDescription
baseThe group container
  • Keyboard accessible
  • Screen-reader labels
  • Focus-visible states
  • ARIA roles and states
  • WCAG 2.2 AA contrast
Explore Button Group interactively Every state, prop, and edge case — with live controls — in Storybook.
View in Storybook