TimelineKit

API Reference

For full TypeScript definitions and detailed signatures, see the generated API documentation.

Properties

data: CalendarDataAll calendars and items (read-only).
settings: EventCalendarSettingsSettings object — access theme, locale, firstDayOfWeek, workingHours, slotDuration (read-only).
events: EventCalendarEventsEvent emitters (read-only).
viewMode: ViewModeCurrent view mode ('month' | 'week' | 'day' | 'agenda').
currentDate: DateThe date the calendar is centered on.
canEdit: booleanEnable/disable editing. Default: true.
sidebarVisible: booleanShow/hide the sidebar (mini calendar + calendar list). Default: true.
selectedEntries: CalendarEntry[]Currently selected entries.
selectedEntry: CalendarEntry | nullLast selected entry (or null).
entryRendering: EntryRenderFn | nullCustom entry rendering function.
entryTooltip: EntryTooltipFn | nullCustom tooltip content function.
canUndo$: BehaviorSubject<boolean>Whether undo is available (observable, read-only).
canRedo$: BehaviorSubject<boolean>Whether redo is available (observable, read-only).

Methods

load(json: string): voidLoad data from a JSON string.
save(): stringSerialize current state to a JSON string.
today(): voidNavigate to today's date.
next(): voidNavigate to the next period (day/week/month).
previous(): voidNavigate to the previous period.
goToDate(date: Date): voidNavigate to a specific date.
undo(): voidUndo the last action.
redo(): voidRedo the last undone action.
copyEntries(entries?: CalendarEntry[]): Promise<void>Copy entries to clipboard (defaults to selected).
cutEntries(entries?: CalendarEntry[]): Promise<void>Cut entries to clipboard.
pasteEntries(): Promise<void>Paste entries from clipboard.
exportToImage(options?: CalendarImageExportOptions): Promise<Blob>Export current view as PNG image. Requires html2canvas.
exportToPdf(options?: CalendarPdfExportOptions): Promise<Blob>Export as PDF document. Requires jspdf.
exportToIcs(options?: CalendarIcsExportOptions): BlobExport as iCalendar (.ics) file (RFC 5545).
exportToIcsText(options?: CalendarIcsExportOptions): stringExport as iCalendar text string.
exportToCsv(options?: CalendarCsvExportOptions): stringExport as CSV string.
exportToExcel(options?: CalendarExcelExportOptions): Promise<Blob>Export as Excel (.xlsx). Requires exceljs.
importFromIcs(text: string, options?: CalendarIcsImportOptions): CalendarIcsImportResultImport from iCalendar text.
destroy(): voidDestroy the calendar and release all DOM resources.

Events

All events are RxJS Subject instances. Subscribe via calendar.events.eventName$.subscribe(callback).

Calendar Data Events

calendarAdded$: Subject<CalendarEventArgs>A calendar was added.
calendarChanged$: Subject<CalendarEventArgs>A calendar property changed.
calendarRemoved$: Subject<CalendarEventArgs>A calendar was removed.
calendarAddRequested$: Subject<void>The 'Add calendar' button was clicked in the sidebar.
calendarRemoving$: Subject<CalendarRemovingArgs>A calendar is about to be removed (cancelable).
itemAdded$: Subject<CalendarItemEventArgs>An item was added.
itemChanged$: Subject<CalendarItemEventArgs>An item property changed.
itemRemoved$: Subject<CalendarItemEventArgs>An item was removed.

Entry Interaction Events

entryClick$: Subject<EntryEventArgs>An entry was clicked.
entryDblClick$: Subject<EntryEventArgs>An entry was double-clicked.
entryContextMenu$: Subject<EntryContextMenuArgs>An entry was right-clicked.
dateClick$: Subject<DateClickArgs>An empty date/time was clicked.
dateContextMenu$: Subject<DateContextMenuArgs>An empty date/time was right-clicked.
moreClick$: Subject<MoreClickArgs>The '+N more' overflow was clicked in month view.

Drag & Resize Events (Cancelable)

entryMoving$: Subject<EntryMovingArgs>An entry is being moved. Set cancel = true to prevent.
entryResizing$: Subject<EntryResizingArgs>An entry is being resized. Set cancel = true to prevent.
entryCreating$: Subject<EntryCreatingArgs>A new entry is being created via drag. Set cancel = true to prevent.
entryDeleting$: Subject<EntryDeletingArgs>An entry is about to be deleted. Set cancel = true to prevent.

Navigation & Selection Events

viewModeChanged$: Subject<ViewMode>The view mode changed.
currentDateChanged$: Subject<Date>The current date changed.
viewDateRangeChanged$: Subject<{ start: Date, end: Date }>The visible date range changed.
selectedEntriesChanged$: Subject<CalendarEntry[]>Entry selection changed.
selectedEntryChanged$: Subject<CalendarEntry | null>Last selected entry changed (or null).
undone$: Subject<void>An undo was performed.
redone$: Subject<void>A redo was performed.

Types & Enums

Calendar

id: stringUnique identifier (auto-generated if not provided).
name: stringDisplay name. Default: ''.
color: ColorValueColor index or custom ColorDefinition. Default: 0.
isVisible: booleanWhether items from this calendar are shown. Default: true.
isDefault: booleanWhether this is the default calendar for new items. Default: false.
isReadOnly: booleanWhether items in this calendar can be edited. Default: false.
timeZone: string | nullIANA time zone identifier. Default: null.
description: string | nullCalendar description. Default: null.

CalendarItem (base class)

id: stringUnique identifier (read-only, auto-generated if not provided).
type: CalendarItemTypeDiscriminator for the concrete item type (read-only).
calendarId: string | nullID of the calendar this item belongs to. Default: null.
startTime: Date | nullStart date/time. Default: null.
endTime: Date | nullEnd date/time (must be >= startTime). Default: null.
timeZone: string | nullIANA time zone identifier. Default: null.
isAllDay: booleanWhether this is an all-day event. Default: false.
title: string | nullDisplay title. Default: null.
description: string | nullDescription or notes. Default: null.
location: string | nullLocation text. Default: null.
color: ColorValueColor index or custom ColorDefinition. Default: 0 (inherits from calendar).
visibility: CalendarItemVisibilityVisibility level. Default: 'public'.
recurrenceRule: RecurrenceRule | nullRecurrence rule for repeating events. Default: null.
recurrenceExceptions: readonly RecurrenceException[]Occurrence overrides/cancellations (read-only array).
isRecurring: booleanWhether item has a recurrence rule (computed, read-only).
hasReminders: booleanWhether reminders are set. Default: false.
externalSource: ExternalSource | string | nullSource system identifier. Default: null.
tags: string[] | nullTags/categories. Default: null.
data: anyArbitrary user data. Default: undefined.

CalendarItem Methods

setException(exception: RecurrenceException): voidAdd or update a recurrence exception.
removeException(originalStartTime: Date): voidRemove a recurrence exception.
cancelOccurrence(originalStartTime: Date): voidCancel a single occurrence (EXDATE).
getException(originalStartTime: Date): RecurrenceException | nullGet exception for a specific occurrence.
clearExceptions(): voidRemove all recurrence exceptions.
clone(newId: string | null): CalendarItemCreate a deep copy with a new ID.
addProperty(property: CustomProperty): voidAdd a custom property.
removeProperty(property: CustomProperty): voidRemove a custom property.
getPropertyByName(name: string): CustomProperty | nullGet a custom property by name.
getPropertyValue(name: string): anyGet a custom property value.
setPropertyValue(name: string, value: any): voidSet a custom property value.

CalendarItemType

'meeting'Meeting with attendees, RSVP, and organizer. Class: Meeting.
'appointment'Personal time block without attendees. Class: Appointment.
'task'Task with deadline and completion state. Class: Task.
'deadline'Milestone without duration. Class: Deadline.
'availabilityBlock'Focus/OOF/busy/tentative block. Class: AvailabilityBlock.
'holiday'Public/company holiday (typically read-only). Class: Holiday.
'birthday'Birthday (typically from contacts). Class: Birthday.
'reminder'Standalone reminder without duration. Class: Reminder.
'resourceBooking'Shared resource booking (room, vehicle). Class: ResourceBooking.

Meeting (extends CalendarItem)

responseStatus: ResponseStatusUser's RSVP status. Default: 'needsAction'.
attendeeCount: numberNumber of attendees. Default: 0.
hasConference: booleanWhether a video conference link is attached. Default: false.
organizer: string | nullOrganizer name or email. Default: null.

Task (extends CalendarItem)

isCompleted: booleanWhether the task is completed. Default: false.
completedAt: Date | nullCompletion timestamp. Default: null.
priority: numberPriority level (0 = none, 1 = highest). Default: 0.

AvailabilityBlock (extends CalendarItem)

availabilityStatus: AvailabilityStatusAvailability type. Default: 'busy'.

Birthday (extends CalendarItem)

contactName: string | nullContact name. Default: null.

ResourceBooking (extends CalendarItem)

resourceId: string | nullBooked resource ID. Default: null.
resourceName: string | nullBooked resource display name. Default: null.

CalendarEntry

item: CalendarItemThe master CalendarItem (read-only).
originalStartTime: DateStart time of this occurrence per the recurrence rule (read-only).
exception: RecurrenceException | nullApplied exception, if any (read-only).
id: stringUnique entry ID (itemId for non-recurring, itemId_isoDate for recurring; computed).
type: CalendarItemTypeItem type (computed from item).
calendarId: string | nullCalendar ID (computed from item).
startTime: DateEffective start time (exception override > original; computed).
endTime: DateEffective end time (exception override > computed from duration; computed).
title: string | nullEffective title (exception override > item; computed).
description: string | nullEffective description (computed).
location: string | nullEffective location (computed).
color: ColorValueEffective color (computed).
isAllDay: booleanEffective all-day flag (computed).
timeZone: string | nullEffective time zone (computed).
tags: string[] | nullEffective tags (computed).
isRecurring: booleanWhether the master item is recurring (computed).
isException: booleanWhether this entry has a non-cancelled exception (computed).
isCancelled: booleanWhether this occurrence is cancelled (computed).
responseStatus: ResponseStatusEffective RSVP status (Meeting only; computed).
isCompleted: booleanEffective completion state (Task only; computed).

CalendarData — Calendar Methods

calendarsLength: numberNumber of calendars (read-only).
getCalendar(index: number): CalendarGet calendar by index.
getCalendarById(id: string): Calendar | nullFind calendar by ID.
addCalendar(calendar: Calendar): voidAdd a calendar.
removeCalendar(calendar: Calendar): voidRemove a calendar (cannot remove default).
assignCalendars(calendars: Calendar[]): voidReplace all calendars (at least one must be default).
defaultCalendar: Calendar | nullThe default calendar (read-only, computed).

CalendarData — Item Methods

itemsLength: numberNumber of items (read-only).
getItem(index: number): CalendarItemGet item by index.
getItemById(id: string): CalendarItem | nullFind item by ID.
getItemsForCalendar(calendarId: string): CalendarItem[]Get all items for a calendar.
addItem(item: CalendarItem): voidAdd an item.
removeItem(item: CalendarItem): voidRemove an item.
assignItems(items: CalendarItem[]): voidReplace all items.
clear(): voidRemove all calendars and items.

CalendarData — Entry & Color Methods

getEntries(range: TimeRange): CalendarEntry[]Get expanded entries for visible range (handles recurrence).
getItemColor(item: CalendarItem): ColorValueResolve item color (falls back to calendar color).
getEntryColor(entry: CalendarEntry): ColorValueResolve entry color (falls back to calendar color).

RecurrenceRule

frequency: RecurrenceFrequencyRecurrence frequency (required).
interval: numberInterval between occurrences. Default: 1.
until: Date | nullEnd date (mutually exclusive with count). Default: null.
count: number | nullMax number of occurrences (mutually exclusive with until). Default: null.
byDay: readonly WeekdayOrdinal[]Days of the week (e.g. MO, 2TU for second Tuesday). Default: [].
byMonthDay: readonly number[]Days of the month (1-31, negative from end). Default: [].
byMonth: readonly number[]Months (1-12). Default: [].
bySetPos: readonly number[]Position within the frequency period. Default: [].
weekStart: WeekdayFirst day of the week. Default: 'mo'.

RecurrenceRule Methods

constructor(init: RecurrenceRuleInit)Create a new rule from an init object.
static fromString(rrule: string): RecurrenceRuleParse from iCalendar RRULE string.
toString(): stringSerialize to iCalendar RRULE string.
expandBetween(dtStart, rangeStart, rangeEnd): Date[]Generate occurrence dates within a time range.
static fromAny(data: any): RecurrenceRuleDeserialize from JSON.
toAny(): anySerialize to JSON.

RecurrenceException

originalStartTime: DateOriginal occurrence start time (slot identifier).
isCancelled: booleanWhether this occurrence is cancelled (EXDATE).
overrides: CalendarItemOverrides | nullOverridden properties (only set keys override the master).

CalendarItemOverrides

startTime?: DateOverride start time.
endTime?: DateOverride end time.
title?: string | nullOverride title.
description?: string | nullOverride description.
location?: string | nullOverride location.
color?: ColorValueOverride color.
isAllDay?: booleanOverride all-day flag.
timeZone?: string | nullOverride time zone.
tags?: string[] | nullOverride tags.
responseStatus?: ResponseStatusOverride RSVP status (Meeting).
isCompleted?: booleanOverride completion state (Task).
completedAt?: Date | nullOverride completion timestamp (Task).

EventCalendarSettings

locale: TimelineKitLocaleLocale for formatting and translations.
theme: EventCalendarThemeVisual theme.
firstDayOfWeek: numberFirst day of the week (0 = Sunday, 1 = Monday, ...). Default: 1.
showWeekNumbers: booleanShow week numbers in month view and mini calendar. Default: false.
slotDuration: numberTime slot duration in minutes (must divide 60: 5, 10, 15, 20, 30, 60). Default: 30.
workingHours: { start: number, end: number }Working hours range (0-24). Default: { start: 8, end: 17 }.
agendaDays: numberNumber of days shown in agenda view (1-90). Default: 14.

EntryEventArgs

entry: CalendarEntryThe clicked/interacted entry.
domEvent: MouseEventThe original DOM mouse event.

EntryContextMenuArgs

entry: CalendarEntryThe right-clicked entry.
domEvent: MouseEventThe original DOM mouse event.

DateClickArgs

date: DateThe clicked date/time.
isAllDay: booleanWhether the click was in the all-day section.
domEvent: MouseEventThe original DOM mouse event.

DateContextMenuArgs

date: DateThe right-clicked date/time.
isAllDay: booleanWhether the click was in the all-day section.
entry: CalendarEntry | nullEntry under the cursor, if any.
domEvent: MouseEventThe original DOM mouse event.

MoreClickArgs

date: DateThe date of the '+N more' label.
entries: CalendarEntry[]All entries for that date.

EntryMovingArgs (cancelable)

entry: CalendarEntryThe entry being moved.
newStartTime: DateProposed new start time.
newEndTime: DateProposed new end time.
cancel: booleanSet to true to prevent the move.

EntryResizingArgs (cancelable)

entry: CalendarEntryThe entry being resized.
newStartTime: DateProposed new start time.
newEndTime: DateProposed new end time.
edge: 'start' | 'end'Which edge is being resized.
cancel: booleanSet to true to prevent the resize.

EntryCreatingArgs (cancelable)

startTime: DateStart time of the new entry.
endTime: DateEnd time of the new entry.
isAllDay: booleanWhether the entry is in the all-day section.
cancel: booleanSet to true to prevent creation.

EntryDeletingArgs (cancelable)

entry: CalendarEntryThe entry being deleted.
isRecurring: booleanWhether the entry belongs to a recurring series.
scope: 'this' | 'thisAndFollowing' | 'all'Deletion scope for recurring entries. Changeable by subscriber.
cancel: booleanSet to true to prevent deletion.

CalendarRemovingArgs (cancelable)

calendar: CalendarThe calendar being removed.
cancel: booleanSet to true to prevent removal.

CalendarEventArgs

calendar: CalendarThe affected calendar.

CalendarItemEventArgs

item: CalendarItemThe affected item.

EntryRenderArgs

entry: CalendarEntryThe entry being rendered.
element: HTMLElementThe DOM element — modify content/style to customize.
isAllDay: booleanWhether the entry is in the all-day section.
viewMode: ViewModeCurrent view mode.
color: EventCalendarEntryColorResolved color palette for this entry.

EntryRenderFn

(args: EntryRenderArgs) => boolean | voidReturn true if you handled the rendering (default content is cleared). Return false/undefined to keep default rendering.

EntryTooltipArgs

entry: CalendarEntryThe hovered entry.
viewMode: ViewModeCurrent view mode.

EntryTooltipContent

title: stringTooltip title text.
rows?: { label: string, value: string }[]Key-value rows displayed below the title.

EntryTooltipFn

(args: EntryTooltipArgs) => EntryTooltipContent | null | Promise<...>Return content to display, or null to hide tooltip. Async supported.

CalendarImageExportOptions

format?: 'png' | 'jpeg'Image format. Default: 'png'.
quality?: numberJPEG quality (0-1). Default: 0.92.
scale?: numberPixel scale factor. Default: 2.
includeSidebar?: booleanWhether to include the sidebar. Default: false.

CalendarPdfExportOptions

pageSize?: 'A4' | 'A3' | 'Letter' | 'Legal'Page format. Default: 'A4'.
orientation?: 'portrait' | 'landscape'Page orientation. Default: 'landscape'.
margin?: { top, right, bottom, left }Page margins in mm. Default: 10mm all sides.
header?: string | ((page, total) => string)Header text on each page.
footer?: string | ((page, total) => string)Footer text on each page.
quality?: numberImage quality (0-1). Default: 0.92.
scale?: numberPixel scale factor. Default: 2.
includeSidebar?: booleanWhether to include the sidebar. Default: false.

CalendarIcsExportOptions

calendarIds?: string[]Which calendars to export. Default: all.
prodId?: stringPRODID value. Default: '-//TimelineKit//EventCalendar//EN'.
includeCustomType?: booleanInclude X-TIMELINEKIT-TYPE property. Default: true.

CalendarCsvExportOptions

delimiter?: ',' | ';' | '\t'Column delimiter. Default: ','.
includeHeaders?: booleanInclude column headers. Default: true.
includeCalendars?: booleanInclude a calendars section. Default: false.
calendarIds?: string[]Export only these calendars. Default: all.

CalendarExcelExportOptions

eventsSheetName?: stringName of the events sheet. Default: locale-dependent.
includeCalendarsSheet?: booleanInclude a sheet listing calendars. Default: true.
includeFormatting?: booleanApply formatting (bold headers, column widths, frozen row). Default: true.
calendarIds?: string[]Export only these calendars. Default: all.

CalendarIcsImportOptions

calendarId?: stringCalendar ID to assign to imported items. Default: from X-TIMELINEKIT-CALENDAR or null.
createCalendar?: booleanCreate a Calendar from VCALENDAR metadata. Default: true.
defaultType?: CalendarItemTypeDefault item type when X-TIMELINEKIT-TYPE is absent. Default: 'appointment'.

CalendarIcsImportResult

calendar: Calendar | nullCreated calendar (if createCalendar was true and metadata was present).
items: CalendarItem[]Imported items (master events with exceptions attached).
warnings: string[]Non-fatal warnings encountered during parsing.
skippedCount: numberCount of skipped components (unsupported types, parse errors).

ViewMode

'month'Monthly grid view.
'week'Weekly time-grid view (default).
'day'Single-day time-grid view.
'agenda'Scrollable list of upcoming entries.

RecurrenceFrequency

'daily'Repeats every N days.
'weekly'Repeats every N weeks.
'monthly'Repeats every N months.
'yearly'Repeats every N years.

Weekday

'mo' | 'tu' | 'we' | 'th' | 'fr' | 'sa' | 'su'Day of the week (lowercase two-letter codes).

WeekdayOrdinal

day: WeekdayDay of the week.
ordinal?: numberPosition within the month (1-5, or -1 for last, -2 for second-to-last).

CalendarItemVisibility

'public'Full content visible to everyone with calendar access.
'private'Others see only 'Busy' and the time, not title/description.
'confidential'Others don't see the item (only aggregated free/busy).

ResponseStatus

'accepted'Invitation accepted.
'tentative'Tentatively accepted.
'declined'Invitation declined.
'needsAction'No response yet (default).

AvailabilityStatus

'busy'Busy (default).
'free'Free / available.
'tentative'Tentatively busy.
'outOfOffice'Out of office.
'workingElsewhere'Working from another location.
'focus'Focus time / do not disturb.

ExternalSource

'native' | 'google' | 'outlook' | 'apple'Common calendar providers.
'caldav' | 'ical' | 'office365' | 'exchange'Protocol / platform sources.

Shared Types

ColorValuenumber (palette index) | ColorDefinition (custom color object).
ColorDefinition{ color1: string, color2: string } — gradient/accent colors for entries.
EventCalendarEntryColorResolved color palette: color1, color2, textColor, chipBackgroundColor, chipTextColor.
CustomProperty{ name: string, value: any } — custom key-value property on items.
TimeRange{ start: Date, end: Date } — time range for entry expansion.

EventCalendarTheme

font: FontDefault font. Default: system font stack.
colorScheme: 'light' | 'dark'Color scheme hint for native elements.
toolbar: EventCalendarToolbarStyleToolbar area styles (background, buttons, height).
header: EventCalendarHeaderStyleDay header styles (today highlight, weekend color).
content: EventCalendarContentStyleMain content area (grid, entries, time indicators, slots).
sidebar: EventCalendarSidebarStyleSidebar styles (mini calendar, calendar list).
allDay: EventCalendarAllDayStyleAll-day section styles (min/max height, row height).
timeGutter: EventCalendarTimeGutterStyleTime gutter styles (width, font size, colors).