collapsedResources
The resources (by id) whose children a timeline hides — its tree’s folded branches.
| Type | readonly string[] |
|---|---|
| Default | [] |
Live update (update()) | Yes |
| Declared in | packages/core/src/kernel.ts |
What it does
Section titled “What it does”In the Pro’s timeline (import '@dzcalendar/pro'), a resource with
children (parentId) shows a button that folds and unfolds them. What is
folded is the calendar’s state: collapsedResources sets it, it survives
update(), and onResourceToggle reports each change — keep it, and give it
back next time, so the tree opens as the person left it.
update({ collapsedResources }) folds and unfolds from your code.
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';import '@dzcalendar/pro';
const saved = JSON.parse(localStorage.getItem('folded') ?? '[]') as string[];
createCalendar(element, { timeZone: 'Europe/Paris', initialView: 'resourceTimelineDay', resources: [ { id: 'cardio', title: 'Cardiology' }, { id: 'benali', title: 'Dr Benali', parentId: 'cardio' }, { id: 'haddad', title: 'Dr Haddad', parentId: 'cardio' }, ], collapsedResources: saved, onResourceToggle: ({ collapsedResources }) => localStorage.setItem('folded', JSON.stringify(collapsedResources)),});import { Component } from '@angular/core';import { DZ_CALENDAR } from '@dzcalendar/angular';import '@dzcalendar/pro';
@Component({ selector: 'app-planning', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Europe/Paris" view="resourceTimelineDay" [resources]="tree" [options]="{ collapsedResources: ['cardio'] }" />`,})export class Planning { readonly tree = [{ id: 'cardio', title: 'Cardiology' }, { id: 'benali', title: 'Dr Benali', parentId: 'cardio' }];}import { DzCalendar } from '@dzcalendar/react';import '@dzcalendar/pro';
const TREE = [{ id: 'cardio', title: 'Cardiology' }, { id: 'benali', title: 'Dr Benali', parentId: 'cardio' }];
export function Planning() { return <DzCalendar timeZone="Europe/Paris" defaultView="resourceTimelineDay" resources={TREE} collapsedResources={['cardio']} />;}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';import '@dzcalendar/pro';
const tree = [{ id: 'cardio', title: 'Cardiology' }, { id: 'benali', title: 'Dr Benali', parentId: 'cardio' }];</script>
<template> <DzCalendar time-zone="Europe/Paris" view="resourceTimelineDay" :resources="tree" :options="{ collapsedResources: ['cardio'] }" /></template>In Angular and Vue it goes in options; in React it is a prop.
Live demo
Section titled “Live demo”The Cardiology department’s doctors folded under it.
See also
Section titled “See also”collapsedGroups— the same for groups.onResourceToggle— what the person folded.- Resources & timeline.