Skip to content

About

A full-featured, zero-dependency calendar component for Svelte 5 — month/week/day/year/agenda views, drag & drop, recurring events, i18n and dark mode

Topics

Resources

Contributing

Stars

16 stars

Watchers

1 watching

Forks

Repository files navigation

svelte5plus-calendar — every calendar view your app needs, in one Svelte 5 component

svelte5plus-calendar

English | 简体中文

npm version license CI

A full-featured, zero-dependency calendar component for Svelte 5 — month, week, day, year and agenda views, drag & drop editing, recurring events, multiple calendars, i18n and dark mode. Feature-set inspired by Google Calendar, Apple Calendar and Outlook.

📖 Docs with live examples: https://blackman99.github.io/svelte5plus-calendar/

svelte5plus-calendar-launch-web.mp4

Features

  • 🗓 Six views — month (spanning multi-day bars, +N more popovers), week & day time grids, year overview, agenda list, and a resources view (rooms/people columns) for booking apps
  • ✋ Drag & drop — move events across days/slots, drag all-day bars along the lane, resize from the bottom edge, drag empty space to select/create; touch devices long-press to drag and swipe to scroll
  • 💬 Built-in popovers — click an event for a details popover (with delete), click/drag empty space for a quick-create popover — zero config, and any callback you provide takes over
  • 🔁 Recurring events — practical RRULE subset (FREQ, INTERVAL, COUNT, UNTIL, BYDAY incl. 2TU/-1FR, BYMONTHDAY) as strings or typed objects, plus exdates; built-in “this event” and “this and following” edits, plus occurrence/series deletion
  • 🎨 Theming — light/dark/auto; every color, radius and font is a CSS custom property; 10-color event palette that adapts to dark mode
  • 🌍 i18n & time zones — any BCP-47 locale via Intl (no bundles); UI strings built in for 10 languages; locale-aware week start and clock; timeZone prop renders any IANA zone with edits converted back automatically
  • 📚 Multiple calendars — sources with shared colors, visibility toggles, per-source and per-event edit permissions
  • ⏰ Time-grid niceties — current-time indicator, business hours shading, configurable hours range/slot size/snapping, ISO week numbers, all-day lane
  • 🧩 Custom rendering — replace event content with Svelte 5 snippets; hide the toolbar and bring your own via bindable date/view
  • 🧮 Headless exports — the overlap-packing and week-segment layout algorithms, recurrence expansion and date utils are exported as pure functions
  • ♿ Accessible — month-grid keyboard navigation, Alt+arrow keyboard editing in time grids, popover focus trapping, aria-live announcements
  • 🔒 Constraints — validRange date windows and eventOverlap={false} double-booking prevention
  • 📤 ICS import/export — parseICS / toICS round-trip iCalendar files, recurrence included
  • 🪶 Zero runtime dependencies, TypeScript-first

Installation

npm install svelte5plus-calendar

Requires Svelte 5. Styles are imported automatically.

Quick start

<script lang="ts">
	import type { CalendarEvent } from 'svelte5plus-calendar';
	import { Calendar } from 'svelte5plus-calendar';

	let events = $state<CalendarEvent[]>([
		{
			id: '1',
			title: 'Kickoff meeting',
			start: new Date(2026, 7, 13, 10, 0),
			end: new Date(2026, 7, 13, 11, 0),
			color: 'teal'
		},
		{
			id: '2',
			title: 'Conference',
			start: new Date(2026, 7, 17),
			end: new Date(2026, 7, 20),
			allDay: true
		},
		{
			id: '3',
			title: 'Standup',
			start: new Date(2026, 7, 10, 9, 30),
			end: new Date(2026, 7, 10, 9, 45),
			recurrence: 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR'
		}
	]);
</script>

<!-- The calendar fills its parent — give the wrapper a height -->
<div style="height: 640px">
	<Calendar bind:events view="week" locale="en" editable selectable />
</div>

Common recipes

Handle edits (with rollback):

<Calendar
	bind:events
	editable
	onEventChange={async ({ event, start, end, revert }) => {
		try {
			await api.update(event.id, { start, end });
		}
		catch {
			revert();
		}
	}}
/>

Create events by drag-selection:

<Calendar
	bind:events
	selectable
	onSelect={({ start, end, allDay }) => {
		events = [...events, { id: crypto.randomUUID(), title: 'New event', start, end, allDay }];
	}}
/>

Multiple calendars with toggles:

<script lang="ts">
	const sources = $state([
		{ id: 'work', name: 'Work', color: 'blue', visible: true },
		{ id: 'personal', name: 'Personal', color: 'green', visible: true }
	]);
</script>

<Calendar {events} {sources} />

Chinese UI:

<Calendar {events} locale="zh-CN" />

Dark mode & branding:

<Calendar {events} theme="dark" />

<style>
  :global(.s5c) {
    --s5c-accent: #e4572e;
    --s5c-event-radius: 8px;
  }
</style>

API overview

Prop Type Default
events CalendarEvent[] [] bindable — edits write back
date Date today bindable — focused date
view 'day' | 'week' | 'month' | 'year' | 'agenda' 'month' bindable
sources CalendarSource[] [] calendar groups
locale string 'en' BCP-47 tag
editable / selectable boolean false interactions
theme 'light' | 'dark' | 'auto' inherits ancestor data-s5c-theme, else light
firstDayOfWeek 0–6 from locale 0 = Sunday
dayStartHour / dayEndHour number 0 / 24 visible hours
slotDuration / snapDuration minutes 30 / 15 grid & snapping
hourHeight / eventMinHeight px 48 / 18 grid zoom & shortest block (overlap packing respects it)
businessHours boolean | { days, startHour, endHour } null shading
dayMaxEvents number 4 month-cell rows before +N more
weekNumbers / weekends / fixedWeeks / nowIndicator / hour12 / agendaDays / views / header / messages — — see docs

Callbacks: onEventClick(instance, e) · onDateClick(date, allDay) · onSelect({start, end, allDay}) · onEventChange({event, oldStart, oldEnd, start, end, revert}) · onEventCreate(event) · onEventDelete(event, occurrence?) · onSeriesDetach({series, detached, occurrence}) · onSeriesSplit({truncated, created, occurrence}) · onViewChange(view) · onDateChange(date) · onRangeChange(start, end)

Built-in popovers: with editable or selectable and no callbacks, clicking an event opens a details popover and clicking/drag-selecting empty space opens a quick-create popover. Providing onEventClick / onSelect / onDateClick replaces them; eventDetails={false} / quickCreate={false} disables them.

Theming from an ancestor: omit the theme prop and set data-s5c-theme="dark" on any ancestor (e.g. <html>) to switch every calendar at once.

Snippets: eventContent(instance) · toolbarEnd()

Also exported: MiniCalendar (standalone month picker), parseRRule, expandRecurrence, expandEvents, layoutDay, layoutWeekRow, date utilities, and all TypeScript types.

Full reference: see the API Reference page in the docs site.

Compared to…

Honest matrix vs SVAR, Schedule-X, @event-calendar/core, and FullCalendar: docs/comparison.md.

Killer line: zero-dep Svelte 5 calendar — MIT features SVAR puts behind PRO (agenda / year / resources + recurrence). Resources here are column-style rooms/people (not a horizontal Timeline yet).

svelte5plus-calendar vs SVAR / Schedule-X / FullCalendar comparison sheet

Contributing

Contributions are welcome! To run the docs site locally, clone the repo and run npm install && npm run dev. See CONTRIBUTING.md for the project layout, testing, and how releases work.

License

MIT

About

A full-featured, zero-dependency calendar component for Svelte 5 — month/week/day/year/agenda views, drag & drop, recurring events, i18n and dark mode

Topics

Resources

Contributing

Stars

16 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages