Skip to content

EventCalendar ​

EventCalendar shows appointments in day, week and month views, and in an opt-in agenda list, in an IANA time zone and locale, with an all-day row, a "+N more" overflow in the month grid, a now line and a toolbar. With resources, the day view shows one column per room, machine or person. Recurring events follow RFC 5545 rules (expandRecurringEvents, applyRecurringEdit).

It is an opt-in, controlled component. Moves, resizes and new events are edit and create proposals, checked by the synchronous validateEdit and validateCreate; range-change reports the visible range so you can load its events. The calendar never reads the clock or the runtime's time zone, so the server and the client render the same text.

Minimal example ​

vue
<script setup lang="ts">
import { ref } from 'vue'
import { EventCalendar, type CalendarEvent, type EventCalendarEdit } from '@eightkk/vue-weave'
import '@eightkk/vue-weave/style.css'

const date = ref(Date.parse('2026-11-09T00:00:00Z'))
const events = ref<CalendarEvent[]>([
  { id: 'review', label: 'Design review', start: Date.parse('2026-11-10T09:00:00Z'), end: Date.parse('2026-11-10T10:30:00Z') },
])

function apply(change: EventCalendarEdit) {
  events.value = events.value.map(event => event.id === change.id ? { ...event, ...change.after } : event)
}
</script>

<template>
  <EventCalendar v-model:date="date" :events="events" time-zone="UTC" locale="en-GB" @edit="apply" />
</template>

Examples: Event calendar and the example index. Types: CalendarEvent, EventCalendarEdit, EventCalendarExposed. iCalendar import and export are on Interchange and export.

EventCalendar ​

A third controlled component for appointment-style scheduling: a day or week time grid with an all-day row, a month grid, an optional day view with one column per resource (rooms, machines, people) and an opt-in agenda list. Like the other components it never changes its props: moves, resizes, resource changes and new events are emitted as proposals that the parent validates and applies. It is generic over the event type E extends CalendarEvent, inferred from events; its public type is EventCalendarComponent and its template ref type EventCalendarExposed<E>.

vue
<EventCalendar
  v-model:view="view" v-model:date="date" v-model:selected-id="selectedId"
  :events="events" :resources="rooms" :now="now" time-zone="Europe/Berlin" locale="en-GB" creatable
  :validate-edit="noDoubleBooking" @edit="apply" @create="add" @range-change="load"
/>
PropType / defaultMeaning
eventsreadonly E[] (E extends CalendarEvent) / requiredEvents with id, label and a half-open [start, end) interval in epoch milliseconds; see below
datenumber / requiredAnchor date of the view. Supports v-model:date; without a listener the calendar still navigates with local state
viewEventCalendarViewName ('day' | 'week' | 'month' | 'agenda') / 'week'Supports v-model:view, with local state like date. agenda is opt-in; see Agenda view and View types
viewsreadonly EventCalendarViewName[] / ['day', 'week', 'month']The views the built-in view switch offers, in this order. Add 'agenda' to offer the agenda. Unknown or repeated views are reported through validation-error
agendaDaysinteger 1–366 / undefinedLength of the agenda: that many local days from the day of date, and Previous and Next step by that many days. Without it, the agenda shows the week that contains date (from weekStartsOn), like the week view
weekStartsOnnumber / 1First day of a week, 0 = Sunday to 6 = Saturday
timeZonestring / 'UTC'IANA time zone of the days, hours and labels. Days start at local midnight, also across daylight-saving changes
localestring or readonly string[] / 'en-US'Locale of the labels. The runtime's default locale and time zone are never used, so server and client render the same text. An invalid tag is reported through validation-error (Invalid locale: <value>)
dayStart, dayEndinteger / 0, 24First and last-plus-one hour of the time grid (0 <= dayStart < dayEnd <= 24). Events outside are clipped
hourHeightnumber / 48Pixels per hour of the time grid
heightnumber or CSS length / 480Height of the scrolling time grid, and the largest height of the agenda list, which scrolls beyond it
snapnumber / 15Step of pointer and keyboard edits of timed events, in minutes
createDurationnumber / 4 × snapMinutes of an event created by a click without a drag
resourcesreadonly CalendarResource[] / undefined{ id, label, detail? }. The day view shows one column per resource; events of other resources, or without resourceId, are not shown there. Every resourceId must name a resource
readonlyboolean / falseDisables editing and creating
creatableboolean / falseA drag (or click) on an empty part of the time grid, the all-day row or a month day proposes a new event through create
validateEdit, validateCreateEventCalendarEditValidator, EventCalendarCreateValidator / undefinedSynchronous checks; see below
selectedIdstring / undefinedSelected event; supports v-model:selected-id
labelsPartial<EventCalendarLabels> / EnglishToolbar, view names, "All day", "+N more", hints (editHint for the time grid, dayEditHint for the all-day row and the optional monthEditHint for the month view, which defaults to an English hint naming Up and Down, or to dayEditHint when only that is given, and the optional agendaEditHint for the agenda, with the same default rule), rejection texts, now, empty, recurring (default "Recurring", the last part of the accessible name of an occurrence of a recurring series) and the optional agenda (default "Agenda", the agenda's view button and list name)
showToolbarboolean / trueThe built-in toolbar: Previous, Today, Next, the title and the view switch (a group of aria-pressed buttons)
nownumber / undefinedDraws the now line (labels.now) in today's column and enables Today. Supply it for deterministic and server-rendered output; the calendar never reads the clock
formatTime(time: number) => string / intlTimeFormatter({ locale, timeZone })Times in event labels and accessible names, and the hours of the time grid's gutter (each hour on the first column's day). Without it the gutter shows HH:mm
maxMonthLanesinteger / 3Event lanes per week of the month view; more events collapse into a "+N more" button that opens the day view
dirChartDirection / 'ltr'rtl mirrors the grid (logical CSS properties) and swaps Left and Right of the keyboard edits

CalendarEvent<D> has id, start, end, label and the optional allDay (drawn in the all-day row and moved by whole days; give local midnights), resourceId, color (a CSS colour for the event's accent stripe, --vw-calendar-event-accent), tone (teal, blue, amber or violet; default blue), editable (default true; false keeps one event fixed) and data (D), and for recurring events (opt-in, see Recurring events) recurrence, seriesId and recurrenceId. Events of 24 hours or more are drawn in the all-day row too but keep their times. A zero-duration event is a point in time. Overlapping timed events are placed side by side by layoutCalendarDayEvents, multi-day events stacked by packCalendarEventLanes; both are deterministic, so the drawing does not depend on the order of events.

EventPayloadMeaning
editEventCalendarEdit{ id, before, after, mode: 'move' | 'start' | 'end', source: 'pointer' | 'keyboard', resource?: { before, after }, occurrence?: { seriesId, recurrenceId } }, the GanttChart TimelineEdit shape with resource in place of row. The parent applies after (and resource.after); occurrence is present only for an event with seriesId and recurrenceId, for applyRecurringEdit
edit-rejectedchange, reasonvalidateEdit returned false (reason labels.rejected) or a string
createEventCalendarCreate{ start, end, allDay, resourceId?, source: 'pointer' }. The parent assigns an ID and adds the event
create-rejectedproposal, reasonvalidateCreate returned false (labels.createRejected) or a string
select, update:selectedIdidClick or Space on an event
event-activateid, sourceDouble click or Enter
update:date, update:viewdate, viewToolbar navigation and the month day buttons ("Show day …"), which open the day view
range-changerange, viewThe visible range (eventCalendarRange of the view and date) after mounting and whenever it changes: load the events that overlap it
edit-cancelEventCalendarEditCancel{ reason: 'escape' | 'source-changed' | 'pointer-cancel' | 'api', eventIds } when a pointer gesture in flight ends without a proposal
background-clickEventCalendarBackgroundClick{ time, allDay, resourceId? }. Fires when a primary-button press on empty calendar space (a time grid column, an all-day cell or a month day) is released before it moves past the drag threshold and the press proposed no create; with creatable, a click there proposes create instead. In the time grid, time is the time at the pointer rounded down to snap and allDay is false; in the all-day row and the month view, time is the start of the day and allDay is true; resourceId names the resource column of the per-resource day view. It does not fire for events, their handles, the day number and "+N more" buttons, headers or the toolbar. The component's selection follows selectedId, so an application usually clears its controlled selection here
validation-errorErrorInvalid events (Invalid event ID, Duplicate event ID, RangeError: Event <id> must have finite start <= end), resources (Unknown resource in event <id>: <resourceId>), view, views (Unknown event calendar view: <view>, views must be an array of distinct views), agendaDays (agendaDays must be an integer from 1 to 366), date, weekStartsOn, time zone, hours, hourHeight, snap, createDuration, maxMonthLanes, now, locale, height (a finite non-negative number or a CSS string) or dir. The calendar then shows its empty state and rethrows the error, like GanttChart

The validators follow the GanttChart contract: return true or nothing to accept, false for the default message, or a string for a specific message; a blank or whitespace-only string rejects with the default message. A rejection emits the -rejected event and announces the reason in a polite live region, which also announces the new title after navigation. Validators are synchronous; persist in the edit or create listener.

Editing. A pointer drag moves an event (to another day or, in the resource view, another resource column); the top and bottom edges of a timed event resize its start and end in snap steps, measured as displacement so an off-grid start keeps its offset; the end edge of an all-day event resizes it by days. In the month view and the all-day row, events move by whole days, keeping their local times. A dashed preview follows the pointer; a drag in the time grid that rests within 36 px of the top or bottom of its visible part for a quarter of a second scrolls the grid, until the pointer leaves that band or the scroller. The proposal is emitted on release, and the click that ends a drag does not select. Keyboard edits are proposed one step per key press: on a timed event Up and Down move by snap and Shift+Up/Down resize the end; Left and Right move by a day, or in the resource view to the previous or next resource; in the month view and the all-day row Left and Right move by a day, Up and Down by a week (month view) and Shift+Left/Right resize the end of an all-day event. The focus follows the event after the parent applies the edit. Escape, pointer cancellation and loss of capture discard a drag; new events, resources, view, date, time zone, week start, hours, hourHeight, snap or readonly cancel it with reason source-changed. Each event is one button whose name is its label, date and time (or "All day") and resource, such as Design review, Wed, Nov 11 10:00–11:00, Atlas; an event drawn in several columns or weeks is focusable once.

Touch and pen. Pointer events drive mouse, pen and touch alike, with these differences for touch. Editable events have touch-action: none, so a touch on an event drags it at once, like a GanttChart bar or a TaskBoard card; elsewhere a swipe scrolls the time grid or the page. A touch within 14 px of a resizable edge of an event (at most a quarter of the event's size, at least the drawn handle) resizes it instead of moving it. On empty space of a creatable calendar, a tap proposes an event of createDuration (or a whole day), and the click of that tap does not select the new event drawn under the finger; to create by dragging, hold the touch still for half a second until the preview appears, then drag; the page does not scroll during that drag. A touch that moves before then is a scroll: it proposes nothing and, as no edit was shown, reports no edit-cancel. While a touch or pen gesture is in flight, the browser's context menu stays closed, and edge auto-scroll works as for the mouse.

Agenda view ​

view: 'agenda' (opt-in; list it in views to offer it in the view switch) shows the events of the visible range as a chronological list grouped by day. The range is the week that contains date, like the week view, or with agendaDays that many days from the day of date; range-change, eventCalendarRange('agenda', date, { agendaDays }) and Previous and Next follow it. Only days with events are listed (the empty slot or labels.empty when there are none); a multi-day event is listed on every day it covers, with the part on that day (18:00– on its first day, –09:00 on its last), and as all-day on days it covers completely. All-day entries come first, then by start time; the order comes from layoutCalendarAgenda. Recurring series appear as the occurrences you pass, expanded with expandRecurringEvents for the range-change range as in the other views.

The list is a list named labels.agenda ("Agenda"); each day is a list item with the long date (Wednesday, November 11, 2026, in locale and timeZone) that names the nested list of its events. Each entry is an event button with the same accessible name, aria-pressed, event slot (view: 'agenda', after the entry's time) and colours as in the other views; the default content adds the resource label. Click and Space select, double click and Enter emit event-activate. Up and Down move the focus to the previous or next entry, Home and End to the first or last; Left and Right move an editable event by a day (mirrored with dir: 'rtl') and Shift+Left/Right resizes the end of an all-day event, described by labels.agendaEditHint. A multi-day event is a Tab stop once. The agenda has no drag handles, creates nothing and fires no background-click.

View types ​

EventCalendarView is 'day' | 'week' | 'month', as in 1.6, and EventCalendarViewName adds 'agenda'. The component is generic over the views beyond EventCalendarView, inferred from view and views like the event type from events:

PositionType
Props view, viewsAccept any EventCalendarViewName
update:view and v-model:view, the view of range-change, the view of the event and toolbar slots, the toolbar's setViewEventCalendarView for a calendar whose view and views cannot be 'agenda', so code that switches exhaustively over three views, handlers typed (view: EventCalendarView) => void and a ref<EventCalendarView>() keep compiling; EventCalendarViewName for a calendar whose view or views can be 'agenda'
eventCalendarRange, eventCalendarDays, shiftEventCalendarDate, renderEventCalendarSvg (view option)Take any EventCalendarViewName

To use the agenda, type the view state and handlers with EventCalendarViewName: const view = ref<EventCalendarViewName>('week'), :views="['day', 'week', 'month', 'agenda']", @update:view="(view: EventCalendarViewName) => …". No cast is needed. A handler typed with EventCalendarView on a calendar that offers the agenda is a type error, as it should be, since the calendar can emit 'agenda'.

Slots: event({ event, range, selected, allDay, view }) replaces the content of an event button (use non-interactive content), toolbar({ title, view, date, previous, next, today, setView }) replaces the toolbar content, and empty(). Methods: cancelEdit() cancels a gesture in flight (reason api); scrollToTime(time) scrolls the time grid to the time of day of time; exportSvg(options?) and exportPng(options?) export the shown view (see Export to SVG and PNG).

The component renders on the server: it reads the DOM only in event handlers and after mounting, and it creates its hint IDs with useId().

Event calendar helpers ​

The core entry exports the calendar arithmetic and layout that EventCalendar uses, so a server or worker can compute the same ranges. Days follow local dates in timeZone (IANA, default UTC) with weekStartsOn (default 1); invalid views, dates, week starts and zones throw RangeError.

FunctionResult
eventCalendarRange(view, date, options?)The half-open range a view shows: the local day, the week from weekStartsOn, or the whole weeks of the month grid; for agenda the week, or options.agendaDays days (an integer from 1 to 366) from the day of date
eventCalendarDays(view, date, options?)The EventCalendarDays of that range (start, end, year, month 1–12, day, weekday, inMonth)
eventCalendarMonthGrid(date, options?)The month grid as four to six weeks of seven days
shiftEventCalendarDate(view, date, steps, options?)The anchor steps days, weeks or months away (for agenda, weeks or agendaDays days), keeping the local time; months clamp the day (January 31 + 1 month is the end of February)
eventCalendarTimeOfDay(day, time, options?), eventCalendarTimeAt(day, timeOfDay, options?)Local wall-clock milliseconds since the midnight of day, and back. A time grid stays 24 hours tall on 23- and 25-hour days
layoutCalendarDayEvents(events, range, { minDuration? })CalendarEventColumn[]: events clipped to the day, with column and columns of their overlap group. minDuration extends short events for the overlap test only
packCalendarEventLanes(events, days){ segments, lanes }: per event the lowest free lane, the covered startIndex/endIndex and continuesBefore/continuesAfter
layoutCalendarAgenda(events, days)CalendarAgendaDay[]: for every one of days (ascending, non-overlapping) its index, start, end and items, the events that overlap it clipped to the day (CalendarAgendaItem: id, start, end, allDay for allDay events and days covered completely, continuesBefore, continuesAfter). All-day items first, then by start, longer first, then ID; empty items for a day without events. Throws for invalid or duplicate IDs, bad intervals or days, and never changes its arguments
validateCalendarEvents(events, resources?)Throws for invalid or duplicate IDs, bad intervals and unknown resources, with the texts above

Related exported types: EventCalendarView, EventCalendarViewName, CalendarEvent, CalendarResource, EventCalendarOptions, EventCalendarDay, CalendarEventColumn, CalendarEventLane, CalendarEventLaneLayout, EventCalendarEdit, EventCalendarCreate, EventCalendarEditValidator, EventCalendarCreateValidator, EventCalendarEditCancel, EventCalendarEditCancelReason, EventCalendarBackgroundClick, EventCalendarLabels, CalendarAgendaDay, CalendarAgendaItem, EventCalendarComponent and EventCalendarExposed.

Recurring events ​

Recurring events are opt-in and live in the core (@eightkk/vue-weave/core); EventCalendar keeps drawing concrete events. Give an event a recurrence (CalendarRecurrence: rule as a RecurrenceRule or RRULE text, optional exdates and rdates in epoch milliseconds, and the zone: timeZone (IANA) or utcOffsetMinutes). Its start and end are the first instance. Before passing the events to the calendar, replace each series by its occurrences in the visible range with expandRecurringEvents(events, range, { timeZone }); use the range from range-change and the calendar's timeZone. Each occurrence gets id <series id>:<recurrenceId>, seriesId and recurrenceId (its original start). The calendar then appends labels.recurring to its accessible name, adds the vw-is-recurring class (a double accent stripe) and puts occurrence: { seriesId, recurrenceId } in its edit proposals. Ask the user for a scope and apply the edit with applyRecurringEdit:

ts
import { applyRecurringEdit, expandRecurringEvents } from '@eightkk/vue-weave/core'

const shown = computed(() => expandRecurringEvents(events.value, range.value, { timeZone: 'Europe/Berlin' }))
function apply(change: EventCalendarEdit) {
  if (!change.occurrence) return applyPlainEdit(change)
  events.value = applyRecurringEdit(events.value, change.occurrence, { ...change.after, resourceId: change.resource?.after }, scope.value)
}
FunctionResult
parseRecurrenceRule(text, zone?)A RecurrenceRule from RRULE text (with or without RRULE:). A floating or date UNTIL is read in zone ({ timeZone?, utcOffsetMinutes? }, default UTC); a date UNTIL includes its whole local day
formatRecurrenceRule(rule, { timeZone?, utcOffsetMinutes?, allDay? })RRULE text (FREQ, COUNT or UNTIL, INTERVAL, BYMONTH, BYMONTHDAY, BYDAY, BYSETPOS, WKST). UNTIL is UTC, or with allDay the local date
expandRecurrence(series, range, { timeZone?, maxOccurrences? })RecurrenceOccurrence[] (id, seriesId, recurrenceId, start, end): the instances of a RecurrenceSeries (id, start, end and the CalendarRecurrence fields) that overlap the half-open range, sorted by start
expandRecurringEvents(events, range, { timeZone?, maxOccurrences? })The events with each series replaced by its occurrences (copies without recurrence). An event with seriesId and recurrenceId but no recurrence is an override: it replaces the generated occurrence with the same pair. Other events and overrides are returned as they are
applyRecurringEdit(events, target, change, scope, { timeZone?, newSeriesId? })New events after an edit ({ start, end, resourceId? }) or 'delete' of the occurrence target ({ seriesId, recurrenceId }) with scope 'occurrence', 'following' or 'series'

Rules. RecurrenceRule has frequency ('daily', 'weekly', 'monthly' or 'yearly') and the optional interval, count, until (epoch milliseconds, inclusive), byWeekday (RecurrenceWeekday: weekday 0 = Sunday to 6 and an ordinal such as 2 or -1 for MONTHLY and YEARLY), byMonthDay (1 to 31 or -1 to -31), byMonth (1 to 12), bySetPosition and weekStart (WKST, default Monday). They follow RFC 5545 section 3.3.10: BYMONTH limits or expands, BYMONTHDAY and BYDAY expand MONTHLY and YEARLY and limit DAILY, BYDAY expands WEEKLY, BYSETPOS picks from the instances of each period, and a YEARLY BYDAY ordinal counts in the month with BYMONTH and in the year without it. Dates that do not exist (February 30, the 31st of a short month, February 29 outside leap years) are skipped and not counted. Not supported, and rejected with an Error naming the part: the frequencies SECONDLY, MINUTELY and HOURLY and the parts BYSECOND, BYMINUTE, BYHOUR, BYYEARDAY, BYWEEKNO, RSCALE and SKIP. Invalid combinations (COUNT with UNTIL, BYDAY ordinals in DAILY or WEEKLY, BYMONTHDAY with WEEKLY, BYSETPOS without another BY part), unknown and repeated parts also throw an Error, and numbers out of range a RangeError.

Expansion. The first instance is always part of the set, also when until is before it (RFC 5545 section 3.8.5.3); the rule adds later instances, rdates add starts with the duration of the first instance (not counted by COUNT), and exdates remove starts by exact time (they still count towards COUNT). Instances are computed on local wall-clock times of the series zone (recurrence.timeZone, else utcOffsetMinutes, else the timeZone option, else UTC): every occurrence starts at the local time of day of the first instance and keeps its local duration, so a weekly 09:00–10:00 meeting in Europe/Berlin stays 09:00–10:00 across daylight-saving changes and all-day events keep their number of days. Like fromICalendar, a local time skipped by a daylight-saving gap takes the offset before the gap and a repeated one its first occurrence (RFC 5545 section 3.3.5). The work is bounded: without COUNT, periods before the range are skipped; maxOccurrences (default 10,000) limits the instances per series up to the end of the range (with COUNT including the ones before the range) and throws a RangeError beyond; a rule that can never match (month days that none of its months has, such as BYMONTH=2;BYMONTHDAY=30, BYDAY ordinals beyond 5 in a month, or BYSETPOS positions beyond the size of every period) yields only the first instance without walking, and any other rule without instances stops after one 400-year Gregorian cycle of empty periods. Everything is done with loops, and no input is modified.

Edit scopes. 'occurrence' adds an override (id <seriesId>:<recurrenceId>, the series' fields without recurrence) or updates the existing one; a delete adds an EXDATE and removes the override. 'following' ends the series before the occurrence (UNTIL one millisecond before it, or the COUNT of the earlier instances) and, for a change, starts a new series (newSeriesId, default <seriesId>:<recurrenceId>) at the changed occurrence with the remaining COUNT, the later EXDATEs and RDATEs and the later overrides; on the first occurrence it acts like 'series'. An override of the edited occurrence is replaced, so 'following' also works after 'occurrence' on the same occurrence (the new series takes the override's ID). When the occurrence is an RDATE rather than a rule instance, the new series starts at the next rule instance (moved like the occurrence) and the changed occurrence becomes one of its RDATEs, so the rule keeps its pattern (a weekly Thursday rule stays on Thursdays); after the last rule instance the new series has no rule. A recurrenceId that is neither a rule instance nor an RDATE throws an Error. 'series' moves the whole series by the change of the occurrence in local time and gives it the new duration; EXDATEs, RDATEs, UNTIL and override recurrenceIds move with it, and a delete removes the series and its overrides. An override that 'series' or 'following' moves to another recurrenceId (or to the new series) and has the ID 'occurrence' gives it, <seriesId>:<recurrenceId>, takes the ID of its new occurrence, so it never shares an ID with an occurrence of the series; an override with another ID keeps it. When another event already has that new ID, or another moved override takes it too (as two overrides on both sides of a daylight saving change can), the override keeps its old ID; when that old ID is taken too, by another event or by an occurrence a series generates on expansion, the edit throws an Error, so neither the result nor its expansion has duplicate IDs. A move to another local day moves BYDAY weekdays and BYMONTHDAY days by the same number of days. Where that would change what the rule means, the move throws an Error and the caller has to change the rule itself: BYDAY ordinals (2MO moved a day is not 2TU), BYSETPOS, BYMONTHDAY days outside 1 to 28 (or -28 to -1) before or after the move, and BYMONTH when the occurrence moves to another month. Moves within the same day always work. A rule given as text stays text. Unknown series and scopes and duplicate IDs throw an Error, invalid times a RangeError.

Related exported types: RecurrenceFrequency, RecurrenceWeekday, RecurrenceRule, RecurrenceZoneOptions, CalendarRecurrence, RecurrenceSeries, RecurrenceOccurrence, RecurrenceExpandOptions, RecurringEditScope, RecurringEditTarget, RecurringEditChange and RecurringEditOptions.

Released under the MIT License.