views
Views of your own — three days, two weeks, a conference’s dates — beside the built-in ones.
| Type | Readonly<Record<string, ViewSpec | ViewSettings>> |
|---|---|
| Default | not set |
Live update (update()) | No — at creation only |
| Declared in | packages/core/src/kernel.ts |
What it does
Section titled “What it does”Each key is a view’s type (the name initialView, headerViews and
update({ view }) use); each value is either settings — a family and what
differs from a plain view — or a whole view spec. A key equal to a built-in
name overrides it.
family:'timeGrid','dayGrid','list','multiMonth', or the Pro’s'timeline'.durationandalignment('day','week','month','year','none'): how long a period is and where it starts.dateIncrement: how far previous / next move;dayCount: how many shown days (hidden days skipped).visibleRange: a fixed period, whatever the date.hiddenDays: the view’s own hidden weekdays.
Settings are checked when the calendar is made: a duration of nothing, a day
count below 1 or a range that ends before it starts throws a RangeError.
The view’s button label comes from messages.views.
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';
const calendar = createCalendar(element, { timeZone: 'Europe/Paris', initialView: 'threeDays', headerViews: ['threeDays', 'fortnight', 'timeGridWeek'], views: { // Three days from the date shown; previous / next move by three. threeDays: { family: 'timeGrid', duration: { days: 3 } }, // Two weeks from the week's first day, moving one week at a time. fortnight: { family: 'dayGrid', duration: { weeks: 2 }, alignment: 'week', dateIncrement: { weeks: 1 } }, }, messages: { views: { threeDays: '3 days', fortnight: 'Fortnight' } },});import { Component } from '@angular/core';import { DZ_CALENDAR, DZ_CALENDAR_DEFAULTS } from '@dzcalendar/angular';
@Component({ selector: 'app-agenda', imports: [DZ_CALENDAR], // Read when the calendar is made: this component's calendars only (provideDzCalendar for the whole application). providers: [{ provide: DZ_CALENDAR_DEFAULTS, useValue: { views: { threeDays: { family: 'timeGrid', duration: { days: 3 } } } } }], template: `<dz-calendar timeZone="Europe/Paris" view="threeDays" [options]="{ headerViews: ['threeDays', 'timeGridWeek'] }" />`,})export class Agenda {}import { DzCalendar } from '@dzcalendar/react';
export function Agenda() { return ( <DzCalendar timeZone="Europe/Paris" defaultView="threeDays" headerViews={['threeDays', 'timeGridWeek']} initial={{ views: { threeDays: { family: 'timeGrid', duration: { days: 3 } } } }} /> );}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';</script>
<template> <DzCalendar time-zone="Europe/Paris" view="threeDays" :options="{ headerViews: ['threeDays', 'timeGridWeek'] }" :initial="{ views: { threeDays: { family: 'timeGrid', duration: { days: 3 } } } }" /></template>views is read once, when the calendar is made. In Angular it goes in the defaults (provideDzCalendar({ views }) for the application, DZ_CALENDAR_DEFAULTS for a component); in React and Vue, in initial.
Live demo
Section titled “Live demo”Two views of your own in the header: three days at a time, and two weeks.
See also
Section titled “See also”initialView— the view shown first.hiddenDays— days no view shows.- Views — and a drawing of your own with defineView.