layout
zard/layoutFreeComponent
@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/layout.jsonSource
1import { ChangeDetectionStrategy, Component, computed, contentChildren, input, ViewEncapsulation } from '@angular/core';23import type { ClassValue } from 'clsx';45import { layoutVariants, type LayoutVariants } from '@/shared/components/layout/layout.variants';6import { SidebarComponent } from '@/shared/components/layout/sidebar.component';7import { mergeClasses } from '@/shared/utils/merge-classes';89@Component({10 selector: 'z-layout',11 template: `12 <ng-content />13 `,14 changeDetection: ChangeDetectionStrategy.OnPush,15 encapsulation: ViewEncapsulation.None,16 host: {17 '[class]': 'classes()',18 },19 exportAs: 'zLayout',20})21export class LayoutComponent {22 readonly class = input<ClassValue>('');23 readonly zDirection = input<LayoutVariants>('auto');2425 // Query for direct sidebar children to auto-detect layout direction26 private readonly sidebars = contentChildren(SidebarComponent, { descendants: false });2728 private readonly detectedDirection = computed(() => {29 if (this.zDirection() !== 'auto') {30 return this.zDirection();31 }3233 // Auto-detection: Check if there are any sidebar children34 const hasSidebar = this.sidebars().length > 0;35 return hasSidebar ? 'horizontal' : 'vertical';36 });3738 protected readonly classes = computed(() =>39 mergeClasses(40 layoutVariants({41 zDirection: this.detectedDirection(),42 }),43 this.class(),44 ),45 );46}
Files it writes
More from @zard
All 49 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | @zard | Components | Free | no deps · 5 files | |
| alertalert | @zard | Components | Free | no deps · 3 files | |
| alert-dialogalert-dialog | @zard | Components | Free | no deps · 5 files | |
| avataravatar | @zard | Components | Free | no deps · 4 files | |
| badgebadge | @zard | Components | Free | no deps · 3 files | |
| breadcrumbbreadcrumb | @zard | Components | Free | no deps · 4 files | |
| buttonbutton | @zard | Components | Free | no deps · 3 files | |
| button-groupbutton-group | @zard | Components | Free | no deps · 3 files |
