tabs

A set of layered sections of content—known as tab panels—that are displayed one at a time.

PreviousNext
OverviewView your key metrics and recent project activity. Track progress across all your active projects.

You have 12 active projects and 3 pending tasks.

import { ChangeDetectionStrategy, Component } from '@angular/core';

import { ZardCardImports } from '@/shared/components/card/card.imports';

import { ZardTabComponent, ZardTabGroupComponent } from '../tabs.component';

@Component({
  selector: 'z-demo-tabs-preview',
  imports: [ZardTabComponent, ZardTabGroupComponent, ZardCardImports],
  template: `
    <z-tab-group class="w-[400px]">
      <z-tab label="Overview">
        <z-card>
          <z-card-header>
            <z-card-title zTitle="Overview" />
            <z-card-description
              zDescription="View your key metrics and recent project activity. Track progress across all your active projects."
            />
          </z-card-header>
          <p z-card-content class="text-muted-foreground text-sm">You have 12 active projects and 3 pending tasks.</p>
        </z-card>
      </z-tab>
      <z-tab label="Analytics">
        <z-card>
          <z-card-header>
            <z-card-title zTitle="Analytics" />
            <z-card-description
              zDescription="Track performance and user engagement metrics. Monitor trends and identify growth opportunities."
            />
          </z-card-header>
          <p z-card-content class="text-muted-foreground text-sm">Page views are up 25% compared to last month.</p>
        </z-card>
      </z-tab>
      <z-tab label="Reports">
        <z-card>
          <z-card-header>
            <z-card-title zTitle="Reports" />
            <z-card-description
              zDescription="Generate and download your detailed reports. Export data in multiple formats for analysis."
            />
          </z-card-header>
          <p z-card-content class="text-muted-foreground text-sm">You have 5 reports ready and available to export.</p>
        </z-card>
      </z-tab>
      <z-tab label="Settings">
        <z-card>
          <z-card-header>
            <z-card-title zTitle="Settings" />
            <z-card-description
              zDescription="Manage your account preferences and options. Customize your experience to fit your needs."
            />
          </z-card-header>
          <p z-card-content class="text-muted-foreground text-sm">Configure notifications, security, and themes.</p>
        </z-card>
      </z-tab>
    </z-tab-group>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoTabsPreviewComponent {}

Installation

Copy
npx zard-cli@latest add tabs

Usage

import { ZardTabsImports } from '@/shared/components/tabs/tabs.imports';
Copy
<z-tab-group>
  <z-tab label="Account">Account content here.</z-tab>
  <z-tab label="Password">Password content here.</z-tab>
</z-tab-group>
Copy

Examples

line

Use the zVariant="line" input on z-tab-group for a line style.
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { ZardTabComponent, ZardTabGroupComponent } from '../tabs.component';

@Component({
  selector: 'z-demo-tabs-line',
  imports: [ZardTabComponent, ZardTabGroupComponent],
  template: `
    <z-tab-group zVariant="line">
      <z-tab label="Overview" />
      <z-tab label="Analytics" />
      <z-tab label="Reports" />
    </z-tab-group>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoTabsLineComponent {}

vertical

Use zOrientation="vertical" for vertical tabs.
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { ZardTabComponent, ZardTabGroupComponent } from '../tabs.component';

@Component({
  selector: 'z-demo-tabs-vertical',
  imports: [ZardTabComponent, ZardTabGroupComponent],
  template: `
    <div class="flex w-full max-w-md flex-col gap-6">
      <z-tab-group zOrientation="vertical">
        <z-tab label="Account" />
        <z-tab label="Password" />
        <z-tab label="Notifications" />
      </z-tab-group>

      <z-tab-group zOrientation="vertical" zVariant="line">
        <z-tab label="Account" />
        <z-tab label="Password" />
        <z-tab label="Notifications" />
      </z-tab-group>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoTabsVerticalComponent {}

disabled

Set zDisabled on a z-tab to remove it from the tab order and prevent activation.
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { ZardTabComponent, ZardTabGroupComponent } from '../tabs.component';

@Component({
  selector: 'z-demo-tabs-disabled',
  imports: [ZardTabComponent, ZardTabGroupComponent],
  template: `
    <div class="w-full max-w-md">
      <z-tab-group>
        <z-tab label="Home" />
        <z-tab label="Disabled" zDisabled />
      </z-tab-group>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoTabsDisabledComponent {}

icons

Set zIcon on a z-tab to render an ng-icon before the label.
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { provideIcons } from '@ng-icons/core';
import { lucideAppWindow, lucideCode } from '@ng-icons/lucide';

import { ZardTabComponent, ZardTabGroupComponent } from '../tabs.component';

@Component({
  selector: 'z-demo-tabs-icons',
  imports: [ZardTabComponent, ZardTabGroupComponent],
  template: `
    <div class="w-full max-w-md">
      <z-tab-group>
        <z-tab label="Preview" zIcon="lucideAppWindow" />
        <z-tab label="Code" zIcon="lucideCode" />
      </z-tab-group>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [provideIcons({ lucideAppWindow, lucideCode })],
})
export class ZardDemoTabsIconsComponent {}

rtl

To enable RTL support in zard/ui, see the RTL configuration guide.
نظرة عامة

لديك 12 مشروعًا نشطًا و3 مهام معلقة.

// You will notice this example is rendered inside a wrapper that sets the dir and data-lang attributes, and
// reads its text from a translations helper. This is because this site is not RTL by default.
// In your application you won't need either: set dir="rtl" on <html> (or use the CDK Dir directive on a subtree)
// and write the text of your own language. See the RTL guide: https://zardui.com/docs/rtl

import { ChangeDetectionStrategy, Component } from '@angular/core';

import { ZardCardImports } from '@/shared/components/card/card.imports';
import { injectRtlTranslation, type ZardRtlTranslations } from '@/shared/demo-utils/rtl-translation';

import { ZardTabComponent, ZardTabGroupComponent } from '../tabs.component';

const translations: ZardRtlTranslations<{
  overview: string;
  analytics: string;
  reports: string;
  overviewText: string;
  analyticsText: string;
  reportsText: string;
}> = {
  en: {
    dir: 'ltr',
    values: {
      overview: 'Overview',
      analytics: 'Analytics',
      reports: 'Reports',
      overviewText: 'You have 12 active projects and 3 pending tasks.',
      analyticsText: 'Page views are up 25% compared to last month.',
      reportsText: 'Your weekly report is ready to download.',
    },
  },
  ar: {
    dir: 'rtl',
    values: {
      overview: 'نظرة عامة',
      analytics: 'التحليلات',
      reports: 'التقارير',
      overviewText: 'لديك 12 مشروعًا نشطًا و3 مهام معلقة.',
      analyticsText: 'ارتفعت مشاهدات الصفحة بنسبة 25٪ مقارنة بالشهر الماضي.',
      reportsText: 'تقريرك الأسبوعي جاهز للتنزيل.',
    },
  },
  he: {
    dir: 'rtl',
    values: {
      overview: 'סקירה',
      analytics: 'ניתוח נתונים',
      reports: 'דוחות',
      overviewText: 'יש לך 12 פרויקטים פעילים ו-3 משימות ממתינות.',
      analyticsText: 'צפיות בדף עלו ב-25% בהשוואה לחודש שעבר.',
      reportsText: 'הדוח השבועי שלך מוכן להורדה.',
    },
  },
};

@Component({
  selector: 'z-demo-tabs-rtl',
  imports: [ZardTabComponent, ZardTabGroupComponent, ZardCardImports],
  template: `
    <z-tab-group class="w-[400px]">
      <z-tab [label]="i18n.t().overview">
        <z-card>
          <z-card-header>
            <z-card-title [zTitle]="i18n.t().overview" />
          </z-card-header>
          <p z-card-content class="text-muted-foreground text-sm">{{ i18n.t().overviewText }}</p>
        </z-card>
      </z-tab>
      <z-tab [label]="i18n.t().analytics">
        <z-card>
          <z-card-header>
            <z-card-title [zTitle]="i18n.t().analytics" />
          </z-card-header>
          <p z-card-content class="text-muted-foreground text-sm">{{ i18n.t().analyticsText }}</p>
        </z-card>
      </z-tab>
      <z-tab [label]="i18n.t().reports">
        <z-card>
          <z-card-header>
            <z-card-title [zTitle]="i18n.t().reports" />
          </z-card-header>
          <p z-card-content class="text-muted-foreground text-sm">{{ i18n.t().reportsText }}</p>
        </z-card>
      </z-tab>
    </z-tab-group>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoTabsRtlComponent {
  protected readonly i18n = injectRtlTranslation(translations);
}

API Reference

z-tab-groupComponent

A set of layered sections of content — known as tab panels — displayed one at a time. Arrow keys, Home and End move between enabled tabs; in right-to-left layouts the horizontal arrows follow the visual order (ArrowRight moves to the previous tab).

PropertyDescriptionTypeDefault
[class] Custom CSS classes ClassValue ''
[zVariant] Visual variant of the tab navigation 'default' | 'line' 'default'
[zOrientation] Layout direction of the tab group 'horizontal' | 'vertical' 'horizontal'
[zDisabled] Whether the entire tab group is disabled boolean false
(zTabChange) Emits when a new tab is selected EventEmitter<{ index: number; label: string; tab: ZardTabComponent }> -
(zDeselect) Emits when the current tab is deselected EventEmitter<{ index: number; label: string; tab: ZardTabComponent }> -

z-tabComponent

An individual tab. Label is shown in the navigation; projected content becomes the tab panel.

PropertyDescriptionTypeDefault
[label] Label displayed in the tab button string -
[zIcon] Optional ng-icons name shown before the label string -
[zDisabled] Whether this individual tab is disabled boolean false
github iconwhatsapp icondiscord iconX icon

Made with ❤ in Brazil. Open source and available on GitHub .