calendar

A calendar component that allows users to select a date or a range of dates.

PreviousNext
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { ZardCalendarComponent } from '../calendar.component';

@Component({
  selector: 'z-demo-calendar-preview',
  imports: [ZardCalendarComponent],
  template: `
    <z-calendar zMode="single" zCaptionLayout="dropdown" class="rounded-lg border" [(value)]="selectedDate" />
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarPreviewComponent {
  readonly selectedDate = signal<Date | null>(new Date());
}

Installation

Copy
npx zard-cli@latest add calendar

Usage

import { ZardCalendarComponent } from '@/shared/components/calendar/calendar.component';
Copy
<z-calendar zMode="single" class="rounded-lg border"></z-calendar>
Copy

Examples

basic

The calendar renders without a border by default — add class="rounded-lg border" to frame it.
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { ZardCalendarComponent } from '../calendar.component';

@Component({
  selector: 'z-demo-calendar-basic',
  imports: [ZardCalendarComponent],
  template: `
    <z-calendar zMode="single" class="rounded-lg border" />
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarBasicComponent {}

range

Use zMode="range" to let users select a start and an end date, and zNumberOfMonths to show more than one month at a time.
January 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
February 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { ZardCalendarComponent } from '../calendar.component';

const RANGE_LENGTH_IN_DAYS = 30;

function startOfRange(): Date {
  return new Date(new Date().getFullYear(), 0, 12);
}

function addDays(date: Date, days: number): Date {
  const result = new Date(date);
  result.setDate(result.getDate() + days);
  return result;
}

@Component({
  selector: 'z-demo-calendar-range',
  imports: [ZardCalendarComponent],
  template: `
    <z-calendar zMode="range" zNumberOfMonths="2" class="rounded-lg border" [(value)]="dateRange" />
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarRangeComponent {
  readonly dateRange = signal<Date[] | null>([startOfRange(), addDays(startOfRange(), RANGE_LENGTH_IN_DAYS)]);
}

multiple

Use zMode="multiple" to select any number of individual dates.
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat

Selected (0) date(s).

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

import { ZardCalendarComponent } from '../calendar.component';

@Component({
  selector: 'z-demo-calendar-multiple',
  imports: [ZardCalendarComponent],
  template: `
    <div class="flex flex-col gap-4">
      <z-calendar zMode="multiple" class="rounded-lg border" [(value)]="selectedDates" />

      <p class="text-muted-foreground text-sm font-medium">Selected ({{ selectedDates()?.length ?? 0 }}) date(s).</p>
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarMultipleComponent {
  readonly selectedDates = signal<Date[] | null>(null);
}

presets

Compose the calendar with a <z-card /> footer to offer quick date presets.
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

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

import { ZardCalendarComponent } from '../calendar.component';

interface CalendarPreset {
  label: string;
  days: number;
}

const PRESETS: CalendarPreset[] = [
  { label: 'Today', days: 0 },
  { label: 'Tomorrow', days: 1 },
  { label: 'In 3 days', days: 3 },
  { label: 'In a week', days: 7 },
  { label: 'In 2 weeks', days: 14 },
];

@Component({
  selector: 'z-demo-calendar-presets',
  imports: [ZardCalendarComponent, ZardButtonComponent, ZardCardImports],
  template: `
    <z-card zSize="sm" class="mx-auto w-fit max-w-[300px]">
      <z-card-content>
        <z-calendar zMode="single" class="p-0 [--cell-size:--spacing(9.5)]" [(value)]="selectedDate" />
      </z-card-content>
      <z-card-footer zFooterBorder class="flex flex-wrap gap-2">
        @for (preset of presets; track preset.days) {
          <button z-button type="button" zType="outline" zSize="sm" class="flex-1" (click)="selectPreset(preset)">
            {{ preset.label }}
          </button>
        }
      </z-card-footer>
    </z-card>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarPresetsComponent {
  readonly presets = PRESETS;
  readonly selectedDate = signal<Date | null>(new Date());

  selectPreset(preset: CalendarPreset): void {
    const date = new Date();
    date.setDate(date.getDate() + preset.days);
    this.selectedDate.set(date);
  }
}

with time

Pair the calendar with time inputs to build a date and time picker.
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { NgIcon, provideIcons } from '@ng-icons/core';
import { lucideClock2 } from '@ng-icons/lucide';

import { ZardCardImports } from '@/shared/components/card/card.imports';
import { ZardFieldImports } from '@/shared/components/field/field.imports';
import { ZardInputComponent } from '@/shared/components/input/input.component';
import { ZardInputGroupImports } from '@/shared/components/input-group/input-group.imports';

import { ZardCalendarComponent } from '../calendar.component';

@Component({
  selector: 'z-demo-calendar-with-time',
  imports: [
    ZardCalendarComponent,
    ZardCardImports,
    ZardFieldImports,
    ZardInputGroupImports,
    ZardInputComponent,
    NgIcon,
  ],
  template: `
    <z-card zSize="sm" class="mx-auto w-fit">
      <z-card-content>
        <z-calendar zMode="single" class="p-0" [(value)]="selectedDate" />
      </z-card-content>
      <z-card-footer zFooterBorder>
        <div z-field-group>
          <div z-field>
            <label z-field-label for="calendar-time-from">Start Time</label>
            <z-input-group>
              <input
                z-input
                id="calendar-time-from"
                type="time"
                step="1"
                value="10:30:00"
                class="appearance-none [&::-webkit-calendar-picker-indicator]:hidden"
              />
              <z-input-group-addon>
                <ng-icon name="lucideClock2" class="text-muted-foreground" />
              </z-input-group-addon>
            </z-input-group>
          </div>

          <div z-field>
            <label z-field-label for="calendar-time-to">End Time</label>
            <z-input-group>
              <input
                z-input
                id="calendar-time-to"
                type="time"
                step="1"
                value="12:30:00"
                class="appearance-none [&::-webkit-calendar-picker-indicator]:hidden"
              />
              <z-input-group-addon>
                <ng-icon name="lucideClock2" class="text-muted-foreground" />
              </z-input-group-addon>
            </z-input-group>
          </div>
        </div>
      </z-card-footer>
    </z-card>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [provideIcons({ lucideClock2 })],
})
export class ZardDemoCalendarWithTimeComponent {
  readonly selectedDate = signal<Date | null>(new Date());
}

booked dates

Use zDisabledDates to block individual days — here they are struck through to read as booked.
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { ZardCalendarComponent } from '../calendar.component';

const FIRST_BOOKED_DAY = 8;
const BOOKED_DAYS_COUNT = 12;

function bookedDatesOfCurrentMonth(): Date[] {
  const today = new Date();

  return Array.from(
    { length: BOOKED_DAYS_COUNT },
    (_, index) => new Date(today.getFullYear(), today.getMonth(), FIRST_BOOKED_DAY + index),
  );
}

@Component({
  selector: 'z-demo-calendar-booked-dates',
  imports: [ZardCalendarComponent],
  template: `
    <z-calendar
      zMode="single"
      class="rounded-lg border shadow-sm [&_[data-disabled=true]_button]:line-through [&_[data-disabled=true]_button]:opacity-100"
      [zDisabledDates]="bookedDates"
      [(value)]="selectedDate"
    />
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarBookedDatesComponent {
  readonly bookedDates = bookedDatesOfCurrentMonth();
  readonly selectedDate = signal<Date | null>(null);
}

custom cell size

Override the --cell-size CSS variable to resize the whole calendar, and pass a zDayTemplate to render extra content in each day — here a price that changes on weekends.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

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

import { ZardCalendarComponent } from '../calendar.component';

const RANGE_LENGTH_IN_DAYS = 10;

/** December 8 of the current year; the calendar opens on the month of the range start. */
function startOfRange(): Date {
  return new Date(new Date().getFullYear(), 11, 8);
}

function addDays(date: Date, days: number): Date {
  const result = new Date(date);
  result.setDate(result.getDate() + days);
  return result;
}

function isWeekend(date: Date): boolean {
  return date.getDay() === 0 || date.getDay() === 6;
}

@Component({
  selector: 'z-demo-calendar-custom-cell-size',
  imports: [ZardCalendarComponent, ZardCardImports],
  template: `
    <z-card class="mx-auto w-fit p-0">
      <z-card-content class="p-0">
        <z-calendar
          zMode="range"
          zCaptionLayout="dropdown"
          class="[--cell-size:--spacing(10)] md:[--cell-size:--spacing(12)]"
          [zDayTemplate]="day"
          [(value)]="dateRange"
        />
      </z-card-content>
    </z-card>

    <ng-template #day let-day>
      {{ day.date.getDate() }}
      @if (day.isCurrentMonth) {
        <span>{{ isWeekend(day.date) ? '$120' : '$100' }}</span>
      }
    </ng-template>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarCustomCellSizeComponent {
  readonly dateRange = signal<Date[] | null>([startOfRange(), addDays(startOfRange(), RANGE_LENGTH_IN_DAYS)]);

  protected readonly isWeekend = isWeekend;
}

with constraints

Use minDate and maxDate to limit the selectable range, or disabled to turn the whole calendar off.
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { ZardCalendarComponent } from '../calendar.component';

const DAYS_IN_FUTURE = 30;
const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;

@Component({
  selector: 'z-demo-calendar-with-constraints',
  imports: [ZardCalendarComponent],
  template: `
    <div class="flex flex-wrap items-start justify-center gap-6">
      <z-calendar zMode="single" class="rounded-lg border" [minDate]="minDate" [maxDate]="maxDate" />

      <z-calendar zMode="single" class="rounded-lg border" [disabled]="true" />
    </div>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarWithConstraintsComponent {
  readonly minDate = new Date();
  readonly maxDate = new Date(Date.now() + DAYS_IN_FUTURE * MILLISECONDS_PER_DAY);

  constructor() {
    this.minDate.setHours(0, 0, 0, 0);
    this.maxDate.setHours(23, 59, 59, 999);
  }
}

expand year selection range

minDate and maxDate also expand the year dropdown — useful for a date of birth picker.
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';

import { ZardCalendarComponent } from '../calendar.component';

const BIRTH_YEAR_FLOOR = 1950;

@Component({
  selector: 'z-demo-calendar-expand-year-selection-range',
  imports: [ZardCalendarComponent],
  template: `
    <z-calendar
      zMode="single"
      zCaptionLayout="dropdown"
      class="rounded-lg border"
      [minDate]="minDate"
      [maxDate]="maxDate"
      [(value)]="dateOfBirth"
    />
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarExpandYearSelectionRangeComponent {
  readonly minDate = new Date(BIRTH_YEAR_FLOOR, 0, 1);
  readonly maxDate = new Date();
  readonly dateOfBirth = signal<Date | null>(null);
}

i18n

Localize the calendar by providing provideZardI18n() in your application config, or injecting ZardI18nService to switch locales dynamically at runtime. The calendar updates month names, weekday names, and the starting day of the week.
November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';

import { ZardButtonComponent } from '@/shared/components/button/button.component';
import { ZardI18nService } from '@/shared/core/i18n';

import { ZardCalendarI18nService } from '../calendar-i18n.service';
import { ZardCalendarComponent } from '../calendar.component';

@Component({
  selector: 'z-demo-calendar-i18n',
  imports: [ZardCalendarComponent, ZardButtonComponent],
  template: `
    <div class="flex flex-col items-center gap-4">
      <div class="flex flex-wrap justify-center gap-2">
        @for (loc of locales; track loc.code) {
          <button
            z-button
            type="button"
            [zType]="currentLocale() === loc.code ? 'default' : 'outline'"
            zSize="sm"
            (click)="setLocale(loc.code)"
          >
            {{ loc.label }}
          </button>
        }
      </div>

      <z-calendar zMode="single" class="rounded-lg border" />
    </div>
  `,
  providers: [ZardI18nService, ZardCalendarI18nService],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarI18nComponent {
  private readonly i18n = inject(ZardI18nService);

  readonly locales = [
    { code: 'en-US', label: 'English (US)' },
    { code: 'fr-FR', label: 'Français' },
    { code: 'de-DE', label: 'Deutsch' },
    { code: 'es-ES', label: 'Español' },
    { code: 'it-IT', label: 'Italiano' },
    { code: 'pt-BR', label: 'Português' },
  ];

  readonly currentLocale = this.i18n.locale;

  setLocale(code: string): void {
    this.i18n.setLocale(code);
  }
}

Setting the locale code

By default, provideZardI18n() uses the existing LOCALE_ID locale code from @angular/core or en-US. If you want to override it, provide a new value for the locale code:
app.config.ts Copy
import { ApplicationConfig } from '@angular/core';
import { provideZardI18n } from '@/shared/core/i18n';

export const appConfig: ApplicationConfig = {
  providers: [
    provideZardI18n('pt-BR'),
  ],
};

rtl

To enable RTL support in zard/ui, see the RTL configuration guide.
نوفمبر 2026
الأحد
الاثنين
الثلاثاء
الأربعاء
الخميس
الجمعة
السبت
// 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, signal } from '@angular/core';

import { ZardCalendarComponent } from '@/shared/components/calendar/calendar.component';
import { injectRtlTranslation, type ZardRtlTranslations } from '@/shared/demo-utils/rtl-translation';

const translations: ZardRtlTranslations<{ locale: string }> = {
  en: {
    dir: 'ltr',
    values: {
      locale: 'en',
    },
  },
  ar: {
    dir: 'rtl',
    values: {
      locale: 'ar',
    },
  },
  he: {
    dir: 'rtl',
    values: {
      locale: 'he',
    },
  },
};

@Component({
  selector: 'z-demo-calendar-rtl',
  imports: [ZardCalendarComponent],
  template: `
    <z-calendar zMode="single" class="rounded-lg border" [zLocale]="i18n.t().locale" [(value)]="selectedDate" />
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCalendarRtlComponent {
  protected readonly i18n = injectRtlTranslation(translations);
  protected readonly selectedDate = signal<Date | null>(new Date());
}

API Reference

z-calendar

Date or range picker grid, sized by --cell-size and --cell-radius.

Prop
[class]

Custom CSS classes; also overrides the CSS variables

Type
ClassValue
Default
''
[zMode]

Selection mode

Type
'single' | 'multiple' | 'range'
Default
'single'
[value]

Selected date(s), shaped by zMode

Type
CalendarValue
Default
null
[minDate]

Earliest selectable date

Type
Date | null
Default
null
[maxDate]

Latest selectable date

Type
Date | null
Default
null
[disabled]

Disables the calendar

Type
boolean
Default
false
[zCaptionLayout]

Month/year caption as label or native dropdowns

Type
'label' | 'dropdown' | 'dropdown-months' | 'dropdown-years'
Default
'label'
[zButtonVariant]

Variant of the navigation arrows

Type
ZardButtonTypeVariants
Default
'ghost'
[zShowOutsideDays]

Shows days of adjacent months

Type
boolean
Default
true
[zDisabledDates]

Individual days that cannot be selected

Type
Date[]
Default
[]
[zNumberOfMonths]

Months shown side by side

Type
number
Default
1
[zLocale]

BCP 47 locale for this calendar only

Type
string
Default
—
[zDayTemplate]

Custom day content (let-day)

Type
TemplateRef<CalendarDayTemplateContext> | null
Default
null
(dateChange)

Emits when the selection changes

Type
EventEmitter<Date | Date[]>
Default
—
resetNavigation()

Returns the view to the selected value

Type
() => void
Default
—
[--cell-size]

Day cell width and height

Type
length
Default
--spacing(7)
[--cell-radius]

Day cell corner radius

Type
length
Default
var(--radius-md)

ZardCalendarI18nService

Localized month and weekday names, driven by ZardI18nService.

Prop
locale

Current BCP 47 locale

Type
Signal<string>
Default
'en-US'
weekStartsOn

First day of the week (0 = Sunday)

Type
Signal<ZardDayOfWeek>
Default
0
shortMonths

Short month names

Type
Signal<string[]>
Default
—
longMonths

Full month names

Type
Signal<string[]>
Default
—
weekdays

Weekday names ordered by weekStartsOn

Type
Signal<string[]>
Default
—
getMonthNames(format?, locale?)

Month names for a locale

Type
(format?: 'short' | 'long', locale?: string) => string[]
Default
—
getWeekdayNames(format?, weekStartsOn?, locale?)

Weekday names for a locale and start day

Type
(format?: 'short' | 'narrow' | 'long', weekStartsOn?: ZardDayOfWeek, locale?: string) => string[]
Default
—
github iconwhatsapp icondiscord iconX icon

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