Button Group

Groups adjacent buttons into one segmented control in Tailwind, joining borders and rounding only the outer corners. Uses role group for toolbars.

src/registry/ui/button-group.tsx/r/button-group.json

Installation#

bash
npx shadcn@latest add @minidev/button-group

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/button-group.json

Usage#

tsx
import { ButtonGroup } from "@/components/ui/button-group"

export function Example() {
  return (
    <ButtonGroup>
      <Button variant="outline">Left</Button>
      <Button variant="outline">Center</Button>
      <Button variant="outline">Right</Button>
    </ButtonGroup>
  )
}

API reference#

Also accepts every prop of <div>, passed through to the root element.

Examples#

All button components