- Accordion
- Action Bar
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- Badge
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context Menu
- Data List
- Date Picker
- Dialog
- Drawer
- Editable
- Field
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- Marquee
- Menu
- Native Select
- Number Input
- Pagination
- Popover
- Progress
- Prose
- QR Code
- Radio Group
- Rating
- Resizable
- Scroll Area
- Segment Group
- Select
- Separator
- Sheet
- Sidebar
- Signature Pad
- Skeleton
- Skip Nav
- Slider
- Spinner
- Status
- Steps
- Switch
- Table
- Tabs
- Textarea
- Timer
- Toast
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Installation
pnpm dlx shadcn@latest add https://shark.vini.one/r/button-group.json
Usage
import { ButtonGroup, ButtonGroupSeparator, } from "@/components/ui/button-group";
<ButtonGroup> <Button /> <ButtonGroupSeparator /> <Button /> </ButtonGroup>
Accessibility
- Use
aria-labeloraria-labelledbyto label the group.
<ButtonGroup aria-label="Media controls"> {/* Your content here */} </ButtonGroup>
Orientation
The orientation prop controls the layout direction of the button group.
Horizontal
Vertical
Examples
Nested
Button groups can be nested inside other button groups to add spacing between buttons.
Separator
The <ButtonGroupSeparator /> component adds a separator between buttons.
Buttons with variant outline do not need a separator since they have a border. For other variants, a separator is recommended to improve the visual hierarchy.
With Input
Buttons can be combined with input fields in a button group.
With Menu
A menu component can be integrated within a button group for additional options.
With Popover
A popover trigger button can be added to a button group for contextual information or actions.
API Reference
ButtonGroup
Groups buttons together. Uses fieldset for accessibility when applicable.
| Prop | Type | Default |
|---|---|---|
orientation | horizontal, vertical | horizontal |
className | string | - |
ButtonGroupSeparator
Visual divider between buttons. Uses <Separator /> internally.
| Prop | Type | Default |
|---|---|---|
orientation | horizontal, vertical | vertical |
className | string | - |