headerViews
The views the header’s switcher offers, in order.
| Type | readonly string[] |
|---|---|
| Default | month, week and day — the views whose renderer is imported |
Live update (update()) | Yes |
| Declared in | packages/dom/src/calendar.ts |
What it does
Section titled “What it does”Without headerToolbar, the header’s end is these views joined as one
switcher, the current one pressed. By default: month, week and day — those
whose renderer is imported (dayGridMonth, timeGridWeek, timeGridDay
with @dzcalendar/dom). Name any view: a built-in one, one of your views,
listWeek with @dzcalendar/dom/list. A single view: no switcher.
With headerToolbar given, the views are named there instead and this option
is not read. A view whose renderer is not imported is left out and said once
on the console. The buttons’ words come from messages.views.
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';import '@dzcalendar/dom/list';
const calendar = createCalendar(element, { timeZone: 'Europe/Paris', headerViews: ['dayGridMonth', 'timeGridWeek', 'listWeek'] });
// Later: the week alone (no switcher).calendar.update({ headerViews: ['timeGridWeek'] });import { Component } from '@angular/core';import { DZ_CALENDAR } from '@dzcalendar/angular';import '@dzcalendar/dom/list';
@Component({ selector: 'app-agenda', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Europe/Paris" [options]="{ headerViews: ['dayGridMonth', 'timeGridWeek', 'listWeek'] }" />`,})export class Agenda {}import { DzCalendar } from '@dzcalendar/react';import '@dzcalendar/dom/list';
const VIEWS = ['dayGridMonth', 'timeGridWeek', 'listWeek'];
export function Agenda() { return <DzCalendar timeZone="Europe/Paris" headerViews={VIEWS} />;}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';import '@dzcalendar/dom/list';</script>
<template> <DzCalendar time-zone="Europe/Paris" :options="{ headerViews: ['dayGridMonth', 'timeGridWeek', 'listWeek'] }" /></template>In Angular and Vue it goes in options; in React it is a prop.
Live demo
Section titled “Live demo”The header offers the month, the week and the list.
See also
Section titled “See also”headerToolbar— the whole header, the views named in it.views— views of your own to offer.initialView— the one shown first.