Button Group
View on shadcn/uiA container that groups related buttons together with consistent styling.
Installation
pnpm dlx shadcn@latest add https://designsystem.wfp.org/r/button-group.jsonUsage
import {
ButtonGroup,
ButtonGroupSeparator,
ButtonGroupText,
} from "@/components/ui/button-group"<ButtonGroup>
<Button>Button 1</Button>
<Button>Button 2</Button>
</ButtonGroup>Examples
Orientation
Set the orientation prop to change the button group layout.
Size
Control the size of buttons using the size prop on individual buttons.
Nested
Nest <ButtonGroup> components to create button groups with spacing.
Separator
The ButtonGroupSeparator component visually divides buttons within a group.
Split
Create a split button group by adding two buttons (optionally separated by a ButtonGroupSeparator).
Input
Wrap an Input component with buttons.
Input group
Wrap an InputGroup component to create complex input layouts.
Dropdown menu
Create a split button group with a DropdownMenu component.
Select
Pair with a Select component.
Popover
Use with a Popover component.