Saltar al contenido 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​

Abrir Default en Storybook

Spanning Events​

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

Abrir Spanning Events en 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.

Abrir Overflow en Storybook

Monday Start​

Abrir Monday Start en Storybook

Six Weeks​

Abrir Six Weeks en Storybook

With Patterns​

Abrir With Patterns en Storybook

Dense Week​

Abrir Dense Week en Storybook

Small Square​

Abrir Small Square en Storybook

Wide Panel​

Abrir Wide Panel en Storybook

More Than Fit​

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

Abrir More Than Fit en Storybook

See Also​