BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/blode/ui/button-group

Button Group

blode-ui/button-group
FreeComponent

A container that groups related buttons together with shared styling.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/mblode/blode-ui/main/public/r/button-group.json

Source

ui/button-group.tsxraw.githubusercontent.com/mblode/blode-ui/main/public/r/button-group.json
1import { mergeProps } from "@base-ui/react/merge-props";
2import { useRender } from "@base-ui/react/use-render";
3import { cva } from "class-variance-authority";
4import type { VariantProps } from "class-variance-authority";
5
6import { cn } from "@/lib/utils";
7import { Separator } from "@/components/ui/separator";
8
9const buttonGroupVariants = cva(
10 "flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-lg [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1",
11 {
12 defaultVariants: {
13 orientation: "horizontal",
14 },
15 variants: {
16 orientation: {
17 horizontal:
18 "*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-lg! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0",
19 vertical:
20 "flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-lg! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0",
21 },
22 },
23 },
24);
25
26const ButtonGroup = ({
27 className,
28 orientation,
29 ...props
30}: React.ComponentProps<"div"> & VariantProps<typeof buttonGroupVariants>) => (
31 /* oxlint-disable jsx-a11y/prefer-tag-over-role -- role="group" is the WAI-ARIA button group pattern; no native element conveys it */
32 <div
33 className={cn(buttonGroupVariants({ orientation }), className)}
34 data-orientation={orientation}
35 data-slot="button-group"
36 role="group"
37 {...props}
38 />
39 /* oxlint-enable jsx-a11y/prefer-tag-over-role */
40);
41
42const ButtonGroupText = ({ className, render, ...props }: useRender.ComponentProps<"div">) =>
43 useRender({
44 defaultTagName: "div",
45 props: mergeProps<"div">(
46 {
47 className: cn(
48 "flex items-center gap-2 rounded-lg border bg-muted px-2.5 font-medium text-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none",
49 className,
50 ),
51 },
52 props,
53 ),
54 render,
55 state: {
56 slot: "button-group-text",
57 },
58 });
59
60const ButtonGroupSeparator = ({
61 className,
62 orientation = "vertical",
63 ...props
64}: React.ComponentProps<typeof Separator>) => (
65 <Separator
66 className={cn(
67 "relative self-stretch bg-input data-horizontal:mx-px data-vertical:my-px data-vertical:h-auto data-horizontal:w-auto",
68 className,
69 )}
70// … truncated

What it pulls in

Other registry items

  • button
  • separator

Files it writes

  • registry/default/ui/button-group.tsx

Facts

Registry
blode/ui
Type
registry:ui
Access
Free
Files written
1
Licence
MIT
First indexed
2026-08-01
Last confirmed
today

Go to the source

blode.co mblode/blode-ui on GitHub Raw registry item This item as JSON

More from blode/ui

All 85 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Accordionaccordionblode/uiComponentsFree2 deps
Alertalertblode/uiComponentsFreeno deps
Alert Dialogalert-dialogblode/uiComponentsFree1 dep
Ask User Questionsask-user-questionsblode/uiComponentsFree1 dep
Aspect Ratioaspect-ratioblode/uiComponentsFree1 dep
Attachmentattachmentblode/uiComponentsFree1 dep
Autocompleteautocompleteblode/uiComponentsFree1 dep
Avataravatarblode/uiComponentsFree1 dep
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex