Skip to content
Nana UI

Forms & Inputs

Button Group

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.

View .md Download
Left Middle Right
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)
orientationorientationButtonGroupOrientation'horizontal'Lay the buttons out in a row or a column
separatedseparatedbooleanfalseSpace the buttons apart instead of joining them into one seamless unit
sizesizeSize | undefined—When set, applied to every slotted button so they share one size
variantvariantVariant | undefined—When 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
VariableDescription
--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