ButtonGroup

<ButtonGroup>TailwindCSS Modules

Visually merges adjacent buttons into a continuous segmented control. Useful for toggle groups, pagination, and connected toolbar actions.

InstallationColoxo CLI
npx coloxo add button-group --style coloxo-css
ES Module ImportPlayground / npm package
import { ButtonGroup } from '@coloxo/ui';

Design Tokens:

--cx-brand-600: #2348FF--cx-border-primary: #E2E8F0border-radius: var(--cx-radius-md)divider: 1px solid

1. Variant Matrix

ButtonGroup supports standard Button variants (though secondary variants are most common).

Secondary (Default)Secondary BrandPrimaryIcon Buttons
Group

2. Control heights (Sizes)

The group height is determined by the size prop of its children buttons. Always use identical sizes for children within the same group.

Sizes

size="sm"
Dimensions: 32px (2rem)

Compact toolbars, inline actions

size="md"DEFAULT
Dimensions: 40px (2.5rem)

Standard forms, page headers

size="lg"
Dimensions: 48px (3rem)

Hero sections, touch-friendly interfaces

3. Interactive Props Configurator

Visual Render CanvasHEIGHT: 40PX
tsx
<ButtonGroup>  <Button variant="secondary">Option 1</Button>  <Button variant="secondary">Option 2</Button>  <Button variant="secondary">Option 3</Button></ButtonGroup>

4. Dark theme

ButtonGroup seamlessly adapts its internal borders to dark mode.

5. Enterprise layout compositions

ButtonGroups are often used in data table toolbars and rich text editors.

Documents (124)

Accessibility

Grouping Role

The ButtonGroup automatically applies role='group' to the container so screen readers announce it as a related set of actions.

Focus Management

Focus outlines are correctly handled by elevating the z-index of the focused button to ensure the ring isn't clipped by adjacent items.

Aria Labels

Ensure that IconButtons used inside a group have explicit aria-label props.

Props

NameTypeDefaultDescription
childrenReactNode—Button or IconButton children.