Button Group

Joins a row or column of Buttons (or inputs) so adjacent corners and borders collapse cleanly. Use for segmented controls, attached input + button, or toolbars.

Default

Buttons sit flush against each other with shared borders and rounded outer ends.

Dark previewReplay previewOpen in new tab

Usage

Import the parts you need from the component's folder.

ts
import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText } from "@/components/ui/button-group";

Orientation

Set orientation to vertical to stack the buttons.

Dark previewReplay previewOpen in new tab

Size

Control the size of buttons using the size prop on individual buttons.

Dark previewReplay previewOpen in new tab

Nested

ButtonGroups nest: each child group keeps its own rounded ends.

Dark previewReplay previewOpen in new tab

Separator

ButtonGroupSeparator draws a divider that matches the group's border.

Dark previewReplay previewOpen in new tab

Split

Create a split button group by adding two buttons separated by a ButtonGroupSeparator.

Dark previewReplay previewOpen in new tab

Input

Pair an Input with buttons so they read as one control.

Dark previewReplay previewOpen in new tab

Dropdown Menu

Use a DropdownMenu trigger as the trailing button.

Dark previewReplay previewOpen in new tab

Select

A Select can join the group as its leading control.

Dark previewReplay previewOpen in new tab

Vertical

Project extra: the vertical group on its own.

Dark previewReplay previewOpen in new tab

API Reference

ButtonGroup

PropTypeDefaultDescription
orientation"horizontal" | "vertical""horizontal"Axis of the group.
classstring—Extra classes, merged with cn().

ButtonGroupSeparator / ButtonGroupText

PropTypeDefaultDescription
classstring—Visual separator and inline static text label inside a group.