Button Group
Joins adjacent buttons into one segmented control.
Install
npx shadcn@latest add https://plinth.dhrumilkherde.com/r/button-group.jsonUsage
Works best with variant="outline" buttons. Corners and borders join
automatically.
import { Button } from "@/components/ui/button";
import { ButtonGroup } from "@/components/ui/button-group";
<ButtonGroup>
<Button variant="outline">Copy</Button>
<Button variant="outline">Paste</Button>
</ButtonGroup>With icons
Props
Plain div with role="group"; all styling is applied to the children.
Accepts all div props.
Accessibility
role="group"groups the buttons for assistive tech; add anaria-labeldescribing the set when the context isn't obvious.- Each button keeps its own focus stop and focus ring.