Button Group
glasswave/button-groupFreeComponent
Group related buttons with shared edges and radius.
Live preview
live · rendered by the registry
Rendered by glasswave on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://glasswave.denizisik.com/r/button-group.jsonSource
1"use client";23import { cva, type VariantProps } from "class-variance-authority";4import { cn } from "@/lib/utils";56const buttonGroupVariants = cva(7 cn(8 "inline-flex w-fit items-stretch",9 // Children stay full Buttons with their own glass surface and hover/press10 // animation, so a grouped button behaves identically to a standalone one.11 // Lifting the hovered/focused/active segment keeps its scale, border and12 // ring above the shared seam instead of being clipped by neighbours.13 "[&>*]:relative [&>*]:hover:z-10 [&>*]:focus-visible:z-10 [&>*]:active:z-10",14 ),15 {16 variants: {17 orientation: {18 horizontal:19 "flex-row [&>*:not(:first-child)]:-ml-px [&>*:not(:first-child)]:rounded-l-none [&>*:not(:last-child)]:rounded-r-none",20 vertical:21 "flex-col [&>*:not(:first-child)]:-mt-px [&>*:not(:first-child)]:rounded-t-none [&>*:not(:last-child)]:rounded-b-none",22 },23 },24 defaultVariants: {25 orientation: "horizontal",26 },27 },28);2930export interface ButtonGroupProps31 extends React.ComponentProps<"div">,32 VariantProps<typeof buttonGroupVariants> {33 role?: "group";34}3536export function ButtonGroup({37 className,38 orientation,39 role = "group",40 ...props41}: ButtonGroupProps) {42 return (43 <div44 data-slot="button-group"45 role={role}46 className={cn(buttonGroupVariants({ orientation }), className)}47 {...props}48 />49 );50}
What it pulls in
npm packages
Files it writes
More from glasswave
All 60 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | glasswave | Components | Free | 2 deps | |
| Alertalert | glasswave | Components | Free | 1 dep | |
| Alert Dialogalert-dialog | glasswave | Components | Free | 1 dep | |
| Aspect Ratioaspect-ratio | glasswave | Components | Free | 1 dep | |
| Avataravatar | glasswave | Components | Free | 1 dep | |
| Badgebadge | glasswave | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | glasswave | Components | Free | 2 deps | |
| Buttonbutton | glasswave | Components | Free | 2 deps |
