Skip to main content

WeeklyCalendar

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 Google Calendar-style weekly view. Displays events across 7 days with configurable hour range and automatic overlap handling.

The text grows with the columns, and each block shows its name, ending in "…" when it is too long, then its time and details when it is tall enough. Events that take whole days sit as bars in a row above the hours, with a "+N more" line when there are more than fit.

Import​

import { WeeklyCalendar } from "~lib/calendar/weekly-calendar";

Props​

NameTypeRequiredDefaultDescription
eventsCalendarEvent[]YesN/AEvents to display
weekStartDateDateYesN/AAny day in the week to display
firstDayOfWeek"sunday" | "monday"No"sunday"Which day starts the week
startHournumberNo8First visible hour
endHournumberNo20Hour the grid ends at
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 and times in, such as "Europe/London"
timeFormat"24h" | "12h"No"24h"Label hours and times on a 24-hour or a 12-hour clock

CalendarEvent​

NameTypeRequiredDescription
namestringYesEvent title
startDateYesStart time
endDateYesEnd time
idstringNoUnique identifier
descriptionstringNoShown below the name when the block is tall enough
allDaybooleanNoTakes whole days; drawn in the row above the hours
participantsPerson[]NoShown below description when the block is tall enough
shadingPatternTypeNoFill pattern (solid, diagonal, dots, crosshatch)

Examples​

Default​

Open Default in Storybook

Overlapping Events​

Open Overlapping Events in Storybook

Full Week​

Open Full Week in Storybook

Custom Hours​

Open Custom Hours in Storybook

With Patterns​

Open With Patterns in Storybook

With Participants​

Open With Participants in Storybook

Small Square​

Open Small Square in Storybook

Wide Panel​

Open Wide Panel in Storybook

All-Day Events​

Events that take whole days, and timed events of a day or longer, are drawn as bars above the hours. When there are more than the row holds, a day counts the rest.

Open All Day Events in Storybook

12-Hour Clock​

Open Twelve Hour Clock in Storybook

See Also​