Zum Hauptinhalt springen

MultiWeekCalendar

Every example on this page is live, drawn by the library's Storybook, where you can also change its props and see the result.

A multi-week grid view with horizontally spanning event bars. Supports configurable week count, overflow handling, and week-boundary event splitting.

The grid starts on the week holding startDate. The text grows with the columns, names that are too long end in "…", and each week shows as many rows of bars as its height holds, with a "+N more" line under a day that has more.

Import​

import { MultiWeekCalendar } from "~lib/calendar/multi-week-calendar";

Props​

NameTypeRequiredDefaultDescription
eventsCalendarEvent[]YesN/AEvents to display
startDateDateYesN/AA day in the first week; days outside its month are set back
numberOfWeeksnumberNo4Number of week rows to display
maxEventsPerDaynumberNoAs many as fitMost rows of bars a week shows before "+N more"
firstDayOfWeek"sunday" | "monday"No"sunday"Which day starts the week
widthnumber | stringNo300Container width
heightnumber | stringNo300Container height
size"auto" | "sm" | "md" | "lg"No"auto"Text size; "auto" grows it with the width of the columns
timeZonestringNoThe device's zoneTime zone to read days in, such as "Europe/London"

CalendarEvent​

NameTypeRequiredDescription
namestringYesEvent title
startDateYesStart time
endDateYesEnd time
idstringNoUnique identifier
descriptionstringNoEvent description
allDaybooleanNoTakes whole days, listed ahead of timed events that day
participantsPerson[]NoEvent participants
shadingPatternTypeNoFill pattern (solid, diagonal, dots, crosshatch)

Examples​

Default​

Default in Storybook öffnen

Spanning Events​

Events that span multiple days render as horizontal bars. Events crossing week boundaries are automatically split into separate visual segments.

Spanning Events in Storybook öffnen

Overflow​

When a day has more events than rows, the last row counts the rest with a "+N more" line. maxEventsPerDay caps the rows below what the height would hold.

Overflow in Storybook öffnen

Monday Start​

Monday Start in Storybook öffnen

Six Weeks​

Six Weeks in Storybook öffnen

With Patterns​

With Patterns in Storybook öffnen

Dense Week​

Dense Week in Storybook öffnen

Small Square​

Small Square in Storybook öffnen

Wide Panel​

Wide Panel in Storybook öffnen

More Than Fit​

In a short box each week holds fewer rows of bars, and days count what they cannot show.

More Than Fit in Storybook öffnen

See Also​