BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/Pure UI/button-group

Button Group

pure-ui/button-group
FreeComponent

A customizable button group component

Install it

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

Source

src/registry/pure-ui/ui/button-group/index.tsxraw.githubusercontent.com/MusKRI/pure-ui/main/public/r/button-group.json
1import { mergeProps } from "@base-ui/react/merge-props";
2import { useRender } from "@base-ui/react/use-render";
3import { tv, VariantProps } from "tailwind-variants";
4
5import { cn } from "@/lib/classes";
6import { Separator } from "@/registry/pure-ui/ui/separator";
7
8const buttonGroupVariants = tv({
9 base: `flex w-fit items-stretch *:focus-visible:z-10 *:focus-visible:relative [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md has-[>[data-slot=button-group]]:gap-2 [&_[data-slot=button]]:active:scale-100 [&_button]:active:scale-100`,
10 variants: {
11 orientation: {
12 horizontal:
13 "[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 *:not-nth-last-[1_of_:not([aria-hidden],span[data-base-ui-inert],span[data-base-ui-focus-guard],span[aria-owns])]:rounded-r-none *:not-first:rounded-s-none",
14 vertical:
15 "flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none",
16 },
17 },
18 defaultVariants: {
19 orientation: "horizontal",
20 },
21});
22
23interface ButtonGroupProps
24 extends React.ComponentProps<"div">,
25 VariantProps<typeof buttonGroupVariants> {}
26
27function ButtonGroup({
28 className,
29 orientation = "horizontal",
30 ...props
31}: ButtonGroupProps) {
32 return (
33 <div
34 role="group"
35 data-slot="button-group"
36 data-orientation={orientation}
37 className={cn(buttonGroupVariants({ orientation }), className)}
38 {...props}
39 />
40 );
41}
42
43function ButtonGroupText({
44 className,
45 render,
46 ...props
47}: useRender.ComponentProps<"div">) {
48 const defaultProps = {
49 "data-slot": "button-group-text",
50 className: cn(
51 "bg-muted flex items-center gap-2 rounded-md border px-4 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
52 className
53 ),
54 };
55
56 return useRender({
57 defaultTagName: "div",
58 props: mergeProps(defaultProps, props),
59 render,
60 });
61}
62
63function ButtonGroupSeparator({
64 className,
65 orientation = "horizontal",
66 ...props
67}: React.ComponentProps<typeof Separator>) {
68 return (
69 <Separator
70 data-slot="button-group-separator"
71 orientation={orientation}
72 className={cn(
73// … truncated

What it pulls in

npm packages

  • tailwind-variants
  • clsx
  • tailwind-merge
  • @base-ui/react

Other registry items

  • separator
  • classes

Files it writes

  • src/registry/pure-ui/ui/button-group/index.tsx

Facts

Registry
Pure UI
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
yesterday

Go to the source

pure.kam-ui.com MusKRI/pure-ui on GitHub Raw registry item This item as JSON

More from Pure UI

All 291 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionPure UIComponentsFree4 deps
AvataravatarPure UIComponentsFree3 deps
BadgebadgePure UIComponentsFree4 deps
ButtonbuttonPure UIComponentsFree4 deps
CalendarcalendarPure UIComponentsFree4 deps
CardcardPure UIComponentsFree2 deps
CheckboxcheckboxPure UIComponentsFree4 deps
CollapsiblecollapsiblePure UIComponentsFree3 deps
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