Skip to main content

events

Array of events rendered by the calendar. Required.

Usage

events: CalendarEvent[];

interface CalendarEvent {
id: string | number;
start: Date;
end: Date;
allDay?: boolean;
rrule?: string;
masterEventId?: string | number;
originalDate?: Date;
exdates?: Date[];
duration?: number;
[key: string]: any;
}
FieldTypeDescription
idstring | numberUnique identifier. Required.
startDateEvent start. Required.
endDateEvent end. Required.
allDaybooleanRenders the event as an all-day bar in the multiday section.
rrulestringiCalendar RRULE string. Used when recurring is true.
masterEventIdstring | numberLinks a recurrence exception to its master event.
originalDateDateOriginal occurrence date for an exception.
exdatesDate[]Dates excluded from the recurrence.
durationnumberDuration in milliseconds. Computed internally.
[key: string]anyCustom fields are preserved and forwarded to renderers and event handlers.

Example

<script>
import { Calendar } from "@svar-ui/svelte-calendar";

const events = [
{
id: 1,
start: new Date("2026-05-05T09:00"),
end: new Date("2026-05-05T10:00"),
text: "Standup",
},
{
id: 2,
start: new Date("2026-05-06"),
end: new Date("2026-05-07"),
allDay: true,
text: "Offsite",
},
];
</script>

<Calendar {events} />
  • recurring — turn on RRULE expansion for events that carry an rrule field.
  • eventContent — replace the markup rendered for each event.
  • eventCss — return per-event CSS classes from the same data.
  • getEvents — read the live event list back out of the calendar.
  • Quick start — minimal calendar with an events array.