Button Group

Fuses adjacent Buttons into a single control. Shared border collapses between siblings and only the outer corners round — triggers stay individually keyboard-reachable.

Install

import { ButtonGroup } from '$lib/components/ui/button-group';

Basic

Split button

Toolbar with separator

H1

Vertical

Nested

A horizontal ButtonGroup can contain vertical ButtonGroup children — useful for grid-style toolbars.

With input

Place an Input inside a ButtonGroup to create inline search or filter controls.

With input group

Compose an InputGroup (with prefix text) adjacent to a Button inside a ButtonGroup.

https://

With dropdown menu

Pair a primary action Button with a DropdownMenu trigger to expose overflow options — the classic split-button pattern.

With select

Inline a Select trigger inside a ButtonGroup for contextual option pickers — e.g. unit type next to a number input.

With popover

Open a Popover from a Button that sits inside a ButtonGroup — keeps the trigger flush with its siblings.

ButtonGroup props

ButtonGroup is a presentational wrapper. Each child stays an independent Button with its own focus ring — the group z-indexes focus so rings never clip their neighbors.

PropTypeDescription
'horizontal' | 'vertical'Axis the children fuse along. Vertical stacks; horizontal lines them up.
'pill' | 'default' | 'sm'Outer-corner radius token. Pill matches the signature CTA shape; default downshifts to --radius (14px) for vertical stacks and grid-style toolbars.
stringMerged onto the root via tailwind-merge.
HTMLDivElement | nullTwo-way-bindable element reference.

ButtonGroupSeparator & ButtonGroupText

Separator wraps the shared Separator primitive. Text renders a muted chip for read-only labels inside the group (e.g., a style token).

PropTypeDescription
'horizontal' | 'vertical'ButtonGroupSeparator only — sets the rule axis.
stringPassed to the rendered element.