メインコンテンツまでスキップ

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​

StorybookでDefaultを開く

Overlapping Events​

StorybookでOverlapping Eventsを開く

Full Week​

StorybookでFull Weekを開く

Custom Hours​

StorybookでCustom Hoursを開く

With Patterns​

StorybookでWith Patternsを開く

With Participants​

StorybookでWith Participantsを開く

Small Square​

StorybookでSmall Squareを開く

Wide Panel​

StorybookでWide Panelを開く

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.

StorybookでAll Day Eventsを開く

12-Hour Clock​

StorybookでTwelve Hour Clockを開く

See Also​