Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Code Block
- Collapsible
- Combobox
- Command
- Context Menu
- Copy Button
- Data Table
- Date Picker
- Dialog
- Drawer
- Dropdown Menu
- Empty
- Field
- Form
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Menubar
- Native Select
- Navigation Menu
- Page Header
- Pagination
- Panel
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Section Header
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Stat
- Stat Card
- Switch
- Table
- Tabs
- Textarea
- Theme Toggle
- Toggle
- Toggle Group
- Tooltip
- Typography
Button Group
Groups related buttons together with consistent styling.
01
Installation
Add the button group component with the shadcn CLI.
bash
npx shadcn@latest add https://swiss.ui.unsanity.ai/r/button-group.json02
Usage
tsx
import { ButtonGroup } from "@/components/ui/button-group"03
Examples
With separator
ButtonGroupSeparatorimport { ChevronRightIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { ButtonGroup, ButtonGroupSeparator } from "@/components/ui/button-group"
<ButtonGroup>
<Button variant="outline">Save</Button>
<ButtonGroupSeparator />
<Button variant="outline" size="icon" aria-label="More">
<ChevronRightIcon />
</Button>
</ButtonGroup>With text addon
ButtonGroupTexthttps://
import { Input } from "@/components/ui/input"
import { ButtonGroup, ButtonGroupText } from "@/components/ui/button-group"
<ButtonGroup>
<ButtonGroupText>https://</ButtonGroupText>
<Input placeholder="swiss-ui.dev" className="w-40" />
</ButtonGroup>