Aller au contenu principal

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​

Ouvrir Default dans Storybook

Spanning Events​

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

Ouvrir Spanning Events dans Storybook

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.

Ouvrir Overflow dans Storybook

Monday Start​

Ouvrir Monday Start dans Storybook

Six Weeks​

Ouvrir Six Weeks dans Storybook

With Patterns​

Ouvrir With Patterns dans Storybook

Dense Week​

Ouvrir Dense Week dans Storybook

Small Square​

Ouvrir Small Square dans Storybook

Wide Panel​

Ouvrir Wide Panel dans Storybook

More Than Fit​

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

Ouvrir More Than Fit dans Storybook

See Also​