Skip to content

initialView

The view the calendar shows when it is made.

Typestring
Default'timeGridWeek' — or, with @dzcalendar/dom/base, the first view whose renderer is imported
Live update (update())Yes, as view: update({ view: … })
Declared inpackages/core/src/kernel.ts

A view is a way of drawing a period: a month of day cells, a week of hours, a list. initialView names the one shown first; the person then moves between views with the header’s buttons, and your code with update({ view }).

The views built into @dzcalendar/dom:

Name What it shows
dayGridMonth The month, one cell per day
dayGridWeek, dayGridDay A week, a day, as day cells
timeGridWeek The week, hour by hour (the default)
timeGridDay One day, hour by hour

Two more families are separate entries, imported once:

Name Import
listDay, listWeek, listMonth, listYear import '@dzcalendar/dom/list'
multiMonthYear import '@dzcalendar/dom/multimonth'

The resource views (resourceTimeGridWeek…) and, with @dzcalendar/pro, the timeline views are described in Resources & timeline. Your own views — four days, a conference’s dates — are declared with views and named here like any other.

import { createCalendar } from '@dzcalendar/dom';
import '@dzcalendar/core/recurrence'; // repeating events (rrule)
import '@dzcalendar/dom/list';
const calendar = createCalendar(element, {
timeZone: 'Europe/Paris',
initialView: 'dayGridMonth',
headerToolbar: { start: 'prev,next today', center: 'title', end: 'dayGridMonth,timeGridWeek,listWeek' },
});
// Later: another view.
calendar.update({ view: 'listWeek' });

In the frameworks the option is the component’s view: Angular’s [(view)], React’s defaultView (or view with onViewChange, controlled), Vue’s v-model:view.

The calendar opens on the month; the header switches to the week and the list.

  • headerToolbar — where the view buttons go.
  • events — what the views show.
  • Views — custom views, durations, hidden days.