Button Group
A row or column of connected buttons that reads as one toolbar, where each button runs its own action.
Installation
Button Group imports class-variance-authority (see Installation).
Usage
src/app/app.ts
- The group sets the look of every item. Each item emits its own
pressed. - Nothing stays selected. For buttons that stay on, use a toggle group from Toggle.
- The group hugs its items. Add
class="w-full"to stretch it.
Variants
default fills the items with the secondary color. outline uses the background color inside a border.
Sizes
Vertical
Disabled
Disable the whole group, or one item. A disabled item dims and doesn't emit pressed.
API
UiButtonGroup
No outputs.
UiButtonGroupItem
The file also exports buttonGroupItemVariants and the ButtonGroupVariant, ButtonGroupSize and ButtonGroupOrientation types.
