Saltar al contenido principal

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​

Abrir Default en Storybook

Overlapping Events​

Abrir Overlapping Events en Storybook

Full Week​

Abrir Full Week en Storybook

Custom Hours​

Abrir Custom Hours en Storybook

With Patterns​

Abrir With Patterns en Storybook

With Participants​

Abrir With Participants en Storybook

Small Square​

Abrir Small Square en Storybook

Wide Panel​

Abrir Wide Panel en 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.

Abrir All Day Events en Storybook

12-Hour Clock​

Abrir Twelve Hour Clock en Storybook

See Also​