BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/@zard/button-group

button-group

zard/button-group
FreeComponent

@zard publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by @zard on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://www.zardui.com/r/button-group.json

Source

button-group.component.tswww.zardui.com/r/button-group.json
1import {
2 ChangeDetectionStrategy,
3 Component,
4 computed,
5 Directive,
6 inject,
7 input,
8 ViewEncapsulation,
9} from '@angular/core';
10
11import { type ClassValue } from 'clsx';
12
13import { mergeClasses } from '@/shared/utils/merge-classes';
14
15import {
16 buttonGroupDividerVariants,
17 buttonGroupTextVariants,
18 buttonGroupVariants,
19 type ZardButtonGroupVariants,
20} from './button-group.variants';
21import { ZardSeparatorComponent } from '../separator/separator.component';
22import { type ZardSeparatorVariants } from '../separator/separator.variants';
23
24@Component({
25 selector: 'z-button-group',
26 template: `
27 <ng-content />
28 `,
29 changeDetection: ChangeDetectionStrategy.OnPush,
30 encapsulation: ViewEncapsulation.None,
31 host: {
32 role: 'group',
33 'data-slot': 'button-group',
34 '[class]': 'classes()',
35 '[attr.data-orientation]': 'zOrientation()',
36 '[attr.aria-orientation]': 'zOrientation()',
37 },
38 exportAs: 'zButtonGroup',
39})
40export class ZardButtonGroupComponent {
41 readonly zOrientation = input<Required<ZardButtonGroupVariants>['zOrientation']>('horizontal');
42 readonly class = input<ClassValue>('');
43
44 protected readonly classes = computed(() =>
45 mergeClasses(
46 buttonGroupVariants({
47 zOrientation: this.zOrientation(),
48 }),
49 this.class(),
50 ),
51 );
52}
53
54@Component({
55 selector: 'z-button-group-divider',
56 imports: [ZardSeparatorComponent],
57 template: `
58 <z-separator [class]="classes()" aria-hidden="true" [zOrientation]="orientation()" />
59 `,
60 changeDetection: ChangeDetectionStrategy.OnPush,
61 encapsulation: ViewEncapsulation.None,
62 host: {
63 class: 'contents',
64 'data-slot': 'button-group-separator',
65 },
66 exportAs: 'zButtonGroupDivider',
67})
68export class ZardButtonGroupDividerComponent {
69 readonly zOrientation = input<ZardSeparatorVariants['zOrientation']>(null);
70 readonly class = input<ClassValue>('');
71
72 private readonly parent = inject(ZardButtonGroupComponent, {
73 optional: true,
74 host: true,
75 });
76
77 protected readonly orientation = computed(() => {
78 if (!this.parent || typeof this.zOrientation() === 'string') {
79 return this.zOrientation();
80 }
81
82 return this.parent.zOrientation() === 'vertical' ? 'horizontal' : 'vertical';
83 });
84
85 protected readonly classes = computed(() =>
86 mergeClasses(
87 buttonGroupDividerVariants({
88 zOrientation: this.orientation(),
89 }),
90 this.class(),
91 ),
92 );
93}
94
95@Directive({
96 selector: '[z-button-group-text]',
97 host: {
98// … truncated

What it pulls in

Other registry items

  • separator

Files it writes

  • button-group.component.ts
  • button-group.variants.ts
  • index.ts

Facts

Registry
@zard
Type
registry:component
Access
Free
Files written
3
Licence
MIT
First indexed
2026-08-06
Last confirmed
yesterday

Go to the source

Docs on @zard www.zardui.com zard-ui/zardui on GitHub Raw registry item This item as JSON

More from @zard

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordion@zardComponentsFreeno deps · 5 files
alertalert@zardComponentsFreeno deps · 3 files
alert-dialogalert-dialog@zardComponentsFreeno deps · 5 files
avataravatar@zardComponentsFreeno deps · 4 files
badgebadge@zardComponentsFreeno deps · 3 files
breadcrumbbreadcrumb@zardComponentsFreeno deps · 4 files
buttonbutton@zardComponentsFreeno deps · 3 files
calendarcalendar@zardComponentsFreeno deps · 7 files
BlockDex

Built by

Kynth Studios

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 Studios

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 Studios

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