Birch UI v0.1
Pricing

Event Calendar overviewCalendar

A framework-agnostic event calendar with month, week, day, agenda and year views, recurring events, time zones, iCalendar import and export, and drag-and-drop editing.

Open .md

Birch UI Event Calendar shows events on a calendar the way people expect from desktop calendar apps: a month grid with multi-day bars, week and day time grids, an agenda list and a year overview. It suits team schedules, clinic appointments, class timetables, room bookings and field-service calendars.

It is written in plain TypeScript, renders to the DOM and has no framework or date-library dependency. Like every Birch UI component it follows the shared widget contract, so it works in any framework.

Team calendar with recurring meetings

Loading demo…

View source

Sample data and small UI helpers are imported from the docs' demos/_shared.ts and demos/_scheduler-data.ts files.

demos/calendar-basic.ts
import { createCalendar, type CalendarEvent, type ViewType } from '@birchui/calendar';
import { docsTheme, field, layout, onDocsThemeChange } from './_shared';

export const meta = { title: 'Team calendar with recurring meetings', height: 560 };

interface TeamEvent extends CalendarEvent {
  location?: string;
}

const VIEWS: ViewType[] = ['month', 'week', 'day', 'agenda', 'year'];

function at(day: number, hour: number, minute = 0): Date {
  return new Date(2026, 10, day, hour, minute);
}

function teamEvents(): TeamEvent[] {
  return [
    {
      id: 'standup',
      title: 'Service desk stand-up',
      start: at(2, 9),
      end: at(2, 9, 15),
      rrule: 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR',
      exdates: [at(26, 9)],
      color: '#2563eb',
      location: 'Room 2B',
    },
    {
      id: 'planning',
      title: 'Sprint planning',
      start: at(3, 14),
      end: at(3, 15, 30),
      rrule: 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU',
      color: '#7c3aed',
    },
    {
      id: 'maintenance',
      title: 'Database maintenance window',
      start: at(28, 22),
      end: at(29, 2),
      color: '#b45309',
    },
    { id: 'visit-1', title: 'Site visit: Kestrel Logistics', start: at(10, 10), end: at(10, 12, 30), color: '#0f766e' },
    { id: 'visit-2', title: 'Site visit: Oakridge Clinics', start: at(18, 13), end: at(18, 16), color: '#0f766e' },
    { id: 'review', title: 'Quarterly business review', start: at(20, 11), end: at(20, 12), color: '#be123c' },
    {
      id: 'holiday',
      title: 'Thanksgiving (office closed)',
      start: at(26, 0),
      end: at(28, 0),
      allDay: true,
      color: '#475569',
    },
  ];
}

export default function mount(el: HTMLElement): () => void {
  const { toolbar, body, status } = layout(el);
  const view = document.createElement('select');
  for (const name of VIEWS) view.add(new Option(name, name, name === 'month', name === 'month'));
  toolbar.append(
    field('View', view),
    'Drag or resize an event. Recurring meetings move one occurrence unless you hold Shift.',
  );

  const calendar = createCalendar<TeamEvent>(body, {
    events: teamEvents(),
    view: 'month',
    date: at(17, 9),
    firstDay: 1,
    selectable: true,
    businessHours: { daysOfWeek: [1, 2, 3, 4, 5], startTime: '08:00', endTime: '18:00' },
    theme: docsTheme(),
  });

  const onView = () => calendar.setView(view.value as ViewType);
  view.addEventListener('change', onView);
  let shiftHeld = false;
  const trackShift = (event: KeyboardEvent) => {
    shiftHeld = event.shiftKey;
  };
  document.addEventListener('keydown', trackShift);
  document.addEventListener('keyup', trackShift);

  const time = (d: Date) =>
    d.toLocaleString('en-US', { weekday: 'short', month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' });
  const offs = [
    calendar.on('eventClick', ({ event, occurrence }) => {
      status.textContent = `${event.title}, ${time(occurrence.start)}${event.location ? ` in ${event.location}` : ''}`;
    }),
    calendar.on('eventDrop', (change) => {
      if (change.isRecurring && shiftHeld) change.scope = 'all';
      status.textContent = `${change.event.title} moved to ${time(change.start)} (${change.isRecurring ? `scope: ${change.scope}` : 'single event'})`;
    }),
    calendar.on('eventResize', (change) => {
      status.textContent = `${change.event.title} now ends ${time(change.end)}`;
    }),
    calendar.on('viewChange', ({ view: next }) => {
      view.value = next;
    }),
  ];
  status.textContent = 'Click an event for details.';
  const stopTheme = onDocsThemeChange((theme) => calendar.update({ theme }));
  return () => {
    view.removeEventListener('change', onView);
    document.removeEventListener('keydown', trackShift);
    document.removeEventListener('keyup', trackShift);
    for (const off of offs) off();
    stopTheme();
    calendar.destroy();
  };
}

What it does#

  • Six views: 'month', 'week', 'day', 'days' (an N-day time grid), 'agenda' and 'year', with a toolbar you can rearrange or turn off. See Views.
  • Recurring events from RFC 5545 rules (RRULE with BYDAY ordinals, BYMONTHDAY, BYSETPOS, COUNT, UNTIL, WKST) plus EXDATE exceptions, expanded only for the visible range. See Recurrence.
  • Time zones through Intl, correct across daylight saving changes, including events that belong to a zone of their own. See Time zones.
  • iCalendar import and export with parseICS and toICS. See iCalendar.
  • Editing by drag, resize, select-to-create and keyboard, on mouse and touch, with validators and a read-only mode. See Interactions.
  • Async loading of events per visible range, with cancellation of stale requests. See Event sources.
  • Accessibility: a WAI-ARIA grid month view, roving focus, full screen-reader labels and live announcements. See Keyboard and accessibility.

Install#

Terminal
npm install @birchui/calendar

The package depends on @birchui/core and @birchui/license, which npm installs for you. The stylesheet is injected the first time a calendar is created. To ship the CSS yourself, for example under a strict Content Security Policy, pass injectStyles: false and import it:

TypeScript
import '@birchui/calendar/styles.css';

Create a calendar#

createCalendar(container, options) renders into an element you own and returns the calendar API. Every option is optional; with none at all you get an empty month view for the current month.

team-calendar.ts
import { createCalendar } from '@birchui/calendar';

const calendar = createCalendar(document.getElementById('team-calendar')!, {
  view: 'month',
  date: '2026-12-01',
  timeZone: 'America/Chicago',
  locale: 'en-US',
  height: 640,
  businessHours: { daysOfWeek: [1, 2, 3, 4, 5], startTime: '08:00', endTime: '17:30' },
  events: [
    {
      id: 'standup',
      title: 'Support team stand-up',
      start: '2026-12-01T09:00',
      end: '2026-12-01T09:15',
      rrule: 'FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR',
      exdates: ['2026-12-25T09:00'],
    },
    {
      id: 'visit-3307',
      title: 'Site visit: Northgate Clinic',
      start: '2026-12-08T13:00',
      end: '2026-12-08T15:30',
      color: '#0f766e',
      location: '1450 Northgate Blvd',
    },
    {
      id: 'maintenance',
      title: 'Server maintenance window',
      start: '2026-12-08T22:00',
      end: '2026-12-09T02:00',
      rrule: 'FREQ=MONTHLY;BYDAY=2TU',
      color: '#b45309',
    },
    { id: 'holiday-xmas', title: 'Office closed: Christmas Day', start: '2026-12-25', allDay: true },
  ],
});

calendar.on('eventClick', ({ event, occurrence }) => {
  openEventPanel(event.id, occurrence.start);
});

A few rules worth knowing up front:

  • Strings without an offset, such as '2026-12-08T13:00', are wall-clock times in the calendar's timeZone. Date-only strings, such as '2026-12-25', are all-day. end is exclusive.
  • height defaults to 'auto', which lets the calendar grow to fit its content. Pass a number of pixels for a fixed height with scrolling inside.
  • Extra fields on your events, such as location above, are kept and passed back to you in every payload. location is also read aloud by screen readers.

The widget contract#

createCalendar returns a CalendarApi, which includes the four members every Birch UI component shares:

Member What it does
element The calendar's root element.
update(partial) Applies only the options you pass, without recreating the calendar.
on(event, listener) Subscribes to an event and returns an unsubscribe function. Payloads are always objects.
destroy() Removes the DOM, cancels pending loads and releases every listener and timer.
TypeScript
calendar.update({ view: 'week', timeZone: 'Europe/Berlin' });

const stop = calendar.on('rangeChange', ({ start, end, view }) => {
  console.info(`Showing ${view} from ${start.toISOString()} to ${end.toISOString()}`);
});

stop();
calendar.destroy();

On top of the contract the API has navigation (setView, gotoDate, next, prev, today), data (setEvents, addEvent, updateEvent, removeEvent, getOccurrences), recurrence editing (updateOccurrence, removeOccurrence) and loading (refetch, isLoading). The API and events page lists everything.

Activate your license#

Set the key once for every Birch UI widget on the page, before the first calendar is created, or pass it per instance:

TypeScript
import { setLicenseKey } from '@birchui/license';

setLicenseKey(import.meta.env.VITE_BIRCHUI_LICENSE);
TypeScript
createCalendar(container, { ...options, licenseKey: 'LQ1.…' });

The calendar checks the key for the calendar product. Verification happens in the browser with no network call. A missing or invalid key never disables anything: it adds a small watermark to the calendar and logs one console warning, and on localhost the watermark is skipped. Changing licenseKey through update() re-checks it. See Licensing and activation for key format and seat rules.

Use it in your framework#

The framework adapters do not ship a ready-made calendar component, but each one exports the generic factory it uses for its own components. Pass it calendarDefinition and you get a component that creates the calendar on mount, sends changed props to update() and forwards every calendar event.

TypeScript
import { createCalendar } from '@birchui/calendar';

const calendar = createCalendar(document.getElementById('team-calendar')!, {
  view: 'month',
  events,
  height: 640,
});

calendar.on('eventDrop', ({ event, start, end }) => saveEvent(event.id, { start, end }));

Notes per adapter:

  • React and Solid: options are props, events are on… props (onEventDrop, onRangeChange), and ref gives you the CalendarApi. Props are typed with the base CalendarEvent type.
  • Vue: pass options as attributes (kebab-case is converted to camelCase) or as an options object. Events are kebab-case (@event-drop, @range-change). The component exposes api.
  • Angular: injectBirchWidget needs one output per calendar event, which is why the wrapper declares all twelve. Read the instance from api after the first render.
  • Svelte: createSvelteAction gives you an action. Its parameter is the options plus on (handlers keyed by event name) and onReady (called once with the API).
  • Web Component: createElementClass turns any widget definition into a custom element. optionKeys become properties, attributes are observed and converted to camelCase options, and requiredOptions: [] creates the calendar as soon as the element is connected. Events are kebab-case CustomEvents with the payload in detail, and element.api is the CalendarApi. Define the element in the browser only; the class needs a DOM.

Next steps#

  • Views: month, week, day, agenda and year, the toolbar and navigation.
  • Recurrence: repeating events and editing single occurrences.
  • Interactions: drag, resize, select and validation.
  • Event sources: load events from your server per visible range.

↑ ↓ to move, Enter to open, Esc to close