Button group
Related actions joined into one surface with hairline dividers: a hover highlight glides between segments, the pressed one answers in place, and an attached menu can close the row.
npx shadcn@latest add @silicon-ui/button-groupInstallation
With the shadcn CLI
npx shadcn@latest add @silicon-ui/button-groupManually
Install the dependencies
npm install @radix-ui/react-dropdown-menu lucide-react motionCopy these files into your project
- components/silicon-ui/button-group/button-group.tsx
- components/silicon-ui/button-group/button-group.module.css
Add the foundation, once per app, for the design and motion tokens
npx shadcn@latest add @silicon-ui/silicon-foundation
Usage
API reference
| Prop | Type | Default |
|---|---|---|
items* | ButtonGroupItem[] | — |
label*Accessible name of the group, such as "Document actions". | string | — |
menuAdds a trailing chevron segment that opens these actions in a menu aligned to the group's edge. | ButtonGroupMenu | — |
variant | ButtonGroupVariant
| "outline" |
size | ButtonGroupSize
| "md" |
orientation | ButtonGroupOrientation
| "horizontal" |
collapseLabelsWhen the row does not fit its container, segments with an icon drop their label and keep the icon. Horizontal only. | boolean | true |
disabledDisables every segment and the menu. | boolean | false |
className | string | — |
style | CSSProperties | — |