# Using the Scheduler in your framework

> Render Birch UI Scheduler in React, Vue, Angular, Svelte, Solid or as a Web Component through each adapter's /scheduler entry point.

Every framework adapter includes a scheduler component. It lives in a separate `/scheduler` entry point, so apps that only use the grid never load scheduler code, and `@birchui/scheduler` stays an optional peer dependency.

> **Scheduler: Paid feature. Fully functional without a key; a license removes the watermark. Pricing: https://docs.birchui.com/getting-started/pricing.md**
>
> Birch UI Scheduler is a paid product. It works fully without a key and shows a watermark on non-local hosts until you set one. See [Licensing and activation](https://docs.birchui.com/getting-started/licensing.md).

## Install

Install the scheduler next to your adapter:

```bash
npm install @birchui/core @birchui/scheduler @birchui/react
```

Replace `@birchui/react` with `vue`, `angular`, `svelte`, `solid` or `element` as needed.

| Framework | Import |
| --- | --- |
| React | `import { BirchScheduler } from '@birchui/react/scheduler'` |
| Vue | `import { BirchScheduler } from '@birchui/vue/scheduler'` |
| Angular | `import { BirchSchedulerComponent } from '@birchui/angular/scheduler'` |
| Svelte | `import { BirchScheduler, birchScheduler } from '@birchui/svelte/scheduler'` |
| Solid | `import { BirchScheduler } from '@birchui/solid/scheduler'` |
| Web Component | `import { defineBirchScheduler } from '@birchui/element/scheduler'` |
| JavaScript | `import { createScheduler } from '@birchui/scheduler'` |

Each scheduler component follows the same conventions as the grid component of its adapter: options as props or inputs, events in the framework's style, and the scheduler API through a ref. Read your framework's grid guide first: [React](https://docs.birchui.com/frameworks/react.md), [Vue](https://docs.birchui.com/frameworks/vue.md), [Angular](https://docs.birchui.com/frameworks/angular.md), [Svelte](https://docs.birchui.com/frameworks/svelte.md), [Solid](https://docs.birchui.com/frameworks/solid.md) or [Web Component](https://docs.birchui.com/frameworks/web-component.md).

## Shared data for the examples

All examples below render a field-service dispatch board: technicians as resources and jobs as events.

```ts title="dispatch-data.ts"
import type { SchedulerEvent, SchedulerResource, WorkingTime } from '@birchui/scheduler';

export const technicians: SchedulerResource[] = [
  { id: 'north', name: 'North depot' },
  { id: 'tech-ana', name: 'Ana Ruiz', parentId: 'north', color: '#2563eb' },
  { id: 'tech-omar', name: 'Omar Haddad', parentId: 'north', color: '#0d9488' },
  { id: 'south', name: 'South depot' },
  { id: 'tech-lena', name: 'Lena Fischer', parentId: 'south', color: '#9333ea' },
  { id: 'tech-kofi', name: 'Kofi Mensah', parentId: 'south', color: '#c2410c' },
];

export const jobs: SchedulerEvent[] = [
  { id: 'WO-5521', resourceId: 'tech-ana', title: 'Boiler service, Harbor Cafe', start: '2026-11-30T08:00:00+01:00', end: '2026-11-30T10:30:00+01:00' },
  { id: 'WO-5522', resourceId: 'tech-ana', title: 'Heat pump install, 14 Elm Road', start: '2026-11-30T12:00:00+01:00', end: '2026-11-30T17:00:00+01:00' },
  { id: 'WO-5523', resourceId: 'tech-omar', title: 'Chiller inspection, Lakeside Clinic', start: '2026-11-30T09:00:00+01:00', end: '2026-11-30T11:00:00+01:00' },
  { id: 'WO-5524', resourceId: 'tech-lena', title: 'Emergency leak repair, Grand Hotel', start: '2026-12-01T07:30:00+01:00', end: '2026-12-01T09:00:00+01:00', color: '#dc2626' },
  { id: 'WO-5525', resourceId: 'tech-kofi', title: 'Annual maintenance, Riverside School', start: '2026-12-01T10:00:00+01:00', end: '2026-12-01T15:00:00+01:00' },
];

export const workingTime: WorkingTime = { days: [1, 2, 3, 4, 5], startHour: 7, endHour: 18 };
```

Every scheduler needs `resources`, `start` and `end`. `events`, `viewPreset`, `timeZone`, `snap` (in minutes, `'tick'` or `false`), `workingTime`, `readOnly` and the other options are optional. See [Resources and events](https://docs.birchui.com/scheduler/resources-and-events.md) and [View presets and zoom](https://docs.birchui.com/scheduler/view-presets.md).

## React

```tsx title="DispatchBoard.tsx"
'use client';

import { useRef } from 'react';
import { BirchScheduler } from '@birchui/react/scheduler';
import type { SchedulerApi, SchedulerEvents } from '@birchui/scheduler';
import { jobs, technicians, workingTime } from './dispatch-data';

let nextJob = 6000;

export function DispatchBoard() {
  const scheduler = useRef<SchedulerApi>(null);

  async function saveMove({ event, start, end, resourceId, previous }: SchedulerEvents['eventDrop']) {
    const response = await fetch(`/api/jobs/${event.id}`, {
      method: 'PATCH',
      headers: { 'content-type': 'application/json' },
      body: JSON.stringify({ start, end, resourceId }),
    });
    if (!response.ok) scheduler.current?.updateEvent(event.id, previous);
  }

  function createJob({ start, end, resourceId }: SchedulerEvents['eventCreate']) {
    scheduler.current?.addEvent({ id: `WO-${nextJob++}`, resourceId, start, end, title: 'New job' });
  }

  return (
    <>
      <div className="toolbar">
        <button type="button" onClick={() => scheduler.current?.zoomOut()}>Zoom out</button>
        <button type="button" onClick={() => scheduler.current?.zoomIn()}>Zoom in</button>
        <button type="button" onClick={() => scheduler.current?.scrollToDate(new Date(), 'center')}>Now</button>
      </div>
      <BirchScheduler
        ref={scheduler}
        style={{ height: 560 }}
        resources={technicians}
        events={jobs}
        start="2026-11-30T00:00:00+01:00"
        end="2026-12-05T00:00:00+01:00"
        viewPreset="hourAndDay"
        timeZone="Europe/Berlin"
        snap={15}
        workingTime={workingTime}
        onEventDrop={saveMove}
        onEventCreate={createJob}
        onEventClick={({ event }) => console.info('Open job', event.id)}
      />
    </>
  );
}
```

As with `BirchGrid`, option props are compared by identity and only changed ones are sent to the scheduler, so keep `resources`, `events` and `workingTime` stable between renders. Event props are `on` plus the capitalized event name: `onEventClick`, `onEventDrop`, `onEventResize`, `onEventCreate`, `onEventRemove`, `onScheduleClick`, `onRangeChanged` and so on.

## Vue

```vue title="DispatchBoard.vue"
<script setup lang="ts">
import { ref } from 'vue';
import { BirchScheduler } from '@birchui/vue/scheduler';
import type { SchedulerApi, SchedulerEvents } from '@birchui/scheduler';
import { jobs, technicians, workingTime } from './dispatch-data';

const scheduler = ref<{ api: SchedulerApi | null } | null>(null);

function onEventDrop({ event, start, end, resourceId }: SchedulerEvents['eventDrop']) {
  console.info(`${event.id} moved to ${resourceId}: ${start.toISOString()} to ${end.toISOString()}`);
}
</script>

<template>
  <button type="button" @click="scheduler?.api?.zoomIn()">Zoom in</button>
  <BirchScheduler
    ref="scheduler"
    style="height: 560px"
    :resources="technicians"
    :events="jobs"
    start="2026-11-30T00:00:00+01:00"
    end="2026-12-05T00:00:00+01:00"
    view-preset="hourAndDay"
    time-zone="Europe/Berlin"
    :snap="15"
    :working-time="workingTime"
    @event-drop="onEventDrop"
    @event-click="({ event }) => console.info('Open job', event.id)"
  />
</template>
```

Events use kebab-case names: `@event-click`, `@event-drop`, `@event-resize`, `@event-create`, `@event-remove`, `@schedule-click`, `@range-changed`. The template ref exposes `api`.

## Angular

```ts title="dispatch-board.component.ts"
import { ChangeDetectionStrategy, Component, viewChild } from '@angular/core';
import { BirchSchedulerComponent } from '@birchui/angular/scheduler';
import type { SchedulerEvents, SchedulerOptions } from '@birchui/scheduler';
import { jobs, technicians, workingTime } from './dispatch-data';

@Component({
  selector: 'app-dispatch-board',
  standalone: true,
  imports: [BirchSchedulerComponent],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <button type="button" (click)="scheduler().api?.zoomIn()">Zoom in</button>
    <birchui-scheduler
      class="board"
      [resources]="technicians"
      [events]="jobs"
      start="2026-11-30T00:00:00+01:00"
      end="2026-12-05T00:00:00+01:00"
      [viewPreset]="'hourAndDay'"
      [options]="options"
      (eventDrop)="saveMove($event)"
      (eventClick)="openJob($event.event.id)"
    />
  `,
  styles: `.board { height: 560px; }`,
})
export class DispatchBoardComponent {
  readonly scheduler = viewChild.required(BirchSchedulerComponent);
  readonly technicians = technicians;
  readonly jobs = jobs;
  readonly options: Partial<SchedulerOptions> = { timeZone: 'Europe/Berlin', snap: 15, workingTime };

  saveMove({ event, start, end, resourceId }: SchedulerEvents['eventDrop']): void {
    console.info(`${event.id} moved to ${resourceId}`, start, end);
  }

  openJob(id: string): void {
    console.info('Open job', id);
  }
}
```

`BirchSchedulerComponent` (selector `birchui-scheduler`) has the inputs `options`, `resources`, `events`, `start`, `end`, `viewPreset`, `theme` and `licenseKey`, and one output per scheduler event. Shortcut inputs override the same key in `options`. The `api` property returns the scheduler API after the first browser render.

## Svelte

```svelte title="DispatchBoard.svelte"
<script lang="ts">
  import { BirchScheduler } from '@birchui/svelte/scheduler';
  import type { SchedulerApi } from '@birchui/scheduler';
  import { jobs, technicians, workingTime } from './dispatch-data';

  let api: SchedulerApi | null = $state.raw(null);
</script>

<button type="button" onclick={() => api?.zoomIn()}>Zoom in</button>

<BirchScheduler
  bind:api
  style="height: 560px"
  resources={technicians}
  events={jobs}
  start="2026-11-30T00:00:00+01:00"
  end="2026-12-05T00:00:00+01:00"
  viewPreset="hourAndDay"
  timeZone="Europe/Berlin"
  snap={15}
  {workingTime}
  onEventDrop={({ event, resourceId }) => console.info(`${event.id} moved to ${resourceId}`)}
/>
```

The `birchScheduler` action takes the same options plus `on` and `onReady`, exactly like the [`birchGrid` action](https://docs.birchui.com/frameworks/svelte.md#the-birchuigrid-action):

```svelte
<div
  class="board"
  use:birchScheduler={{
    resources: technicians,
    events: jobs,
    start: '2026-11-30T00:00:00+01:00',
    end: '2026-12-05T00:00:00+01:00',
    on: { eventCreate: ({ start, resourceId }) => console.info('New job for', resourceId, start) },
  }}
></div>
```

## Solid

```tsx title="DispatchBoard.tsx"
import { BirchScheduler } from '@birchui/solid/scheduler';
import type { SchedulerApi } from '@birchui/scheduler';
import { jobs, technicians, workingTime } from './dispatch-data';

export function DispatchBoard() {
  let scheduler: SchedulerApi | undefined;

  return (
    <>
      <button type="button" onClick={() => scheduler?.zoomIn()}>
        Zoom in
      </button>
      <BirchScheduler
        ref={(api) => (scheduler = api)}
        style={{ height: '560px' }}
        resources={technicians}
        events={jobs}
        start="2026-11-30T00:00:00+01:00"
        end="2026-12-05T00:00:00+01:00"
        viewPreset="hourAndDay"
        timeZone="Europe/Berlin"
        snap={15}
        workingTime={workingTime}
        onEventResize={({ event, start, end }) => console.info(`${event.id} now ${start} to ${end}`)}
      />
    </>
  );
}
```

## Web Component

`defineBirchScheduler()` registers `<birchui-scheduler>`. Unlike `<birchui-grid>`, the scheduler element has no per-option properties or attributes: configure it through `options` or `set(key, value)`. The scheduler is created as soon as the connected element has any option, so assign all required options in one step with `options`:

```html title="dispatch.html"
<style>
  birchui-scheduler {
    display: block;
    height: 560px;
  }
</style>

<button id="zoom-in" type="button">Zoom in</button>
<birchui-scheduler id="dispatch"></birchui-scheduler>

<script type="module">
  import { defineBirchScheduler } from '@birchui/element/scheduler';
  import { jobs, technicians, workingTime } from './dispatch-data.js';

  defineBirchScheduler();

  const board = document.querySelector('#dispatch');
  board.options = {
    resources: technicians,
    events: jobs,
    start: '2026-11-30T00:00:00+01:00',
    end: '2026-12-05T00:00:00+01:00',
    viewPreset: 'hourAndDay',
    timeZone: 'Europe/Berlin',
    snap: 15,
    workingTime,
  };

  board.addEventListener('event-drop', (event) => {
    const { event: job, resourceId, start, end } = event.detail;
    console.info(`${job.id} moved to ${resourceId}`, start, end);
  });

  document.querySelector('#zoom-in').addEventListener('click', () => board.api?.zoomIn());
</script>
```

Later changes can use `board.set('readOnly', true)` or `board.options = { ...board.options, viewPreset: 'dayAndWeek' }`. Remember that assigning `options` replaces the whole set. Events are dispatched as `CustomEvent`s named `event-click`, `event-drop`, `event-resize`, `event-create`, `event-remove`, `schedule-click`, `range-changed` and so on, with the payload in `event.detail`.

## JavaScript

```ts title="dispatch.ts"
import { createScheduler } from '@birchui/scheduler';
import { jobs, technicians, workingTime } from './dispatch-data';

const scheduler = createScheduler(document.querySelector<HTMLElement>('#dispatch')!, {
  resources: technicians,
  events: jobs,
  start: '2026-11-30T00:00:00+01:00',
  end: '2026-12-05T00:00:00+01:00',
  viewPreset: 'hourAndDay',
  timeZone: 'Europe/Berlin',
  snap: 15,
  workingTime,
});

scheduler.on('eventDrop', ({ event, resourceId, start, end }) => {
  console.info(`${event.id} moved to ${resourceId}`, start, end);
});

scheduler.update({ viewPreset: 'dayAndWeek' });
```

## Scheduler events

These events are available in every adapter, under each framework's naming convention:

| Event | Payload |
| --- | --- |
| `ready` | `{ api }` |
| `eventClick`, `eventDoubleClick`, `eventContextMenu` | `{ event, resource, domEvent }` |
| `eventDrop` | `{ event, start, end, resourceId, previous, source }` |
| `eventResize` | `{ event, start, end, edge, previous, source }` |
| `eventCreate` | `{ start, end, resourceId, resource }` |
| `eventRemove` | `{ event, source }` |
| `resourceClick` | `{ resource, domEvent }` |
| `resourceToggle` | `{ resource, isExpanded }` |
| `scheduleClick` | `{ date, resourceId, resource, domEvent }` |
| `rangeChanged` | `{ start, end }` |
| `viewPresetChanged` | `{ preset, previous }` |
| `viewportScroll` | `{ left, top, visibleStart, visibleEnd }` |
| `selectionChanged` | `{ selected, previous }` |

`source` is `'pointer'` or `'keyboard'` (and `'api'` for `eventRemove`). To reject a move before it happens, use the `validateDrop` and `validateResize` options. See [Drag, drop, resize and create](https://docs.birchui.com/scheduler/interactions.md).

## Server rendering

The scheduler components follow the same rules as the grid components: importing them is safe on the server, and the scheduler is created in the browser after mount. In Next.js, mark the file that renders `BirchScheduler` with `'use client'`. Give the container a fixed height.

## Next steps

- [Scheduler overview](https://docs.birchui.com/scheduler/overview.md)
- [Scheduler API and events](https://docs.birchui.com/scheduler/api.md)
- [Time zones](https://docs.birchui.com/scheduler/time-zones.md) and [working time](https://docs.birchui.com/scheduler/working-time.md)
