Components
- Accordion
- Action BarUpdated
- Alert Dialog
- Alert
- Announcement
- Aspect Ratio
- Autocomplete
- Avatar
- BadgeUpdated
- Bottom Navigation
- Breadcrumb
- Button Group
- Button
- CalendarUpdated
- CardUpdated
- Carousel
- Chart
- Checkbox
- Circular Progress
- Circular Slider
- Clipboard
- Collapsible
- Color Picker
- Combobox
- Command
- Context MenuUpdated
- Data List
- Date Picker
- DialogUpdated
- DrawerUpdated
- Editable
- FieldUpdated
- File Upload
- Float
- Floating Panel
- Frame
- Hint
- Hover Card
- Image Cropper
- Input Group
- Input OTP
- Input
- Item
- Kbd
- Link Overlay
- Listbox
- MarqueeUpdated
- Menu
- Native Select
- Number InputUpdated
- 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
- TableUpdated
- Tabs
- Textarea
- TimerUpdated
- ToastUpdated
- Toggle Group
- Toggle Tooltip
- Toggle
- Tooltip
- Tour
- Tree View
Hooks
Button Group
Group button elements together.
Installation#
pnpm dlx shadcn@latest add @shark/button-group
Anatomy#
ButtonGroup └── Button or Input ├── ButtonGroupText └── ButtonGroupSeparator
Usage#
import { ButtonGroup, ButtonGroupSeparator, } from "@/components/ui/button-group";
<ButtonGroup> <Button> Archive </Button> <ButtonGroupSeparator /> <Button> Report </Button> </ButtonGroup>
Accessibility#
- Use
aria-labeloraria-labelledbyto label the group.
<ButtonGroup aria-label="Media controls"> <Button>Play</Button> <Button>Pause</Button> </ButtonGroup>
Orientation#
Horizontal#
Vertical#
Examples#
Nested#
Separator#
Buttons with variant outline do not need a separator since they have a border.
With Input#
With Menu#
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 | - |
asChild | boolean | false |
ButtonGroupSeparator#
Visual divider between buttons. Uses Separator internally.
| Prop | Type | Default |
|---|---|---|
orientation | "horizontal" | "vertical" | "vertical" |
className | string | - |
asChild | boolean | false |