Search

Find a component, token or page

Base · Actions

Button group

Joins related buttons into one connected control.

HTML / JSPlannedReactStableReact NativeDraftSwift (SwiftUI)PlannedGodotPlannedVueDraftSvelteDraftSolidDraft
Reviewed

Props

tsx
import { Button } from "@/components/ui/button"
import { ButtonGroup } from "@/components/ui/button-group"

<ButtonGroup aria-label="Shipment actions">
  <Button variant="outline">Archive</Button>
  <Button variant="outline">Reassign</Button>
  <Button variant="outline">Print label</Button>
</ButtonGroup>

Overview

A button group removes the gap between adjacent buttons and merges their borders and corners so they read as a single unit. It only handles layout: each button keeps its own action and state.

When to use

  • For two to four actions that apply to the same object, such as Archive, Reassign and Print label on a shipment.
  • To attach a secondary control to a button, such as a menu trigger next to a primary action (a split button).
  • To attach a fixed text prefix or a select to an input, using ButtonGroupText.

When not to use

  • To choose one or several options that stay pressed: use a Toggle group.
  • To switch between views of the same content: use Tabs.
  • For unrelated actions, or more than four: space Buttons apart or move the extras into a Dropdown menu.

Anatomy

  1. Group

    A flex container with role="group". Sets the direction and squares off the inner corners of its children.

  2. Button

    Any Button, Input or Select trigger placed directly inside. Outline buttons share a single border between neighbors.

  3. Separator (optional)

    ButtonGroupSeparator draws a divider between filled buttons that have no border of their own.

  4. Text (optional)

    ButtonGroupText is a non-interactive muted cell for a prefix or suffix such as “https://”.

Props

The contract every language implements. Names follow each language’s conventions (camelCase in React, snake_case in Rust).

PropTypeDefaultDescription
orientation"horizontal" | "vertical"horizontalDirection the buttons are laid out and joined.
labelstringArchiveText of the first button in the demo. Passed as children of that Button.
childrennode–Buttons, inputs, select triggers, ButtonGroupText or ButtonGroupSeparator. Nest a ButtonGroup to create spaced sub-groups.

States

Rest
Outer corners are rounded, inner corners are square and adjacent borders collapse into one line.
Focus-visible
The focused button is raised above its neighbors so its focus ring is not clipped.
Nested
A group that contains other groups keeps an 8px gap between them.

Accessibility

Role: group

KeysAction
Tab/Shift+TabMoves focus to the next or previous button. Each button is its own tab stop.
Enter/SpaceActivates the focused button.
  • Give the group an accessible name with aria-label or aria-labelledby so screen readers announce what the buttons have in common.
  • The group does not manage focus with arrow keys. If you need roving focus over a set of options, use a Toggle group.
  • Icon-only buttons inside the group still need their own accessible names.

Design tokens

Change any of these in Foundations and this component follows, in every language.

Platform notes

HTML / JS
Planned
Not built in HTML / JS yet.
React
Stable
Matches the contract with no platform differences.
React Native
Draft
A row or column View that squares the inner corners of its children through their style prop and collapses shared borders. Hover styling applies on web and pointer devices only.
Swift (SwiftUI)
Planned
Not built in Swift yet.
Godot
Planned
Not built in Godot yet.
Vue
Draft
Usage snippet only; same props and behavior as the React component.
Svelte
Draft
Usage snippet only; same props and behavior as the React component.
Solid
Draft
Usage snippet only; same props and behavior as the React component.

Related