# Scheduler overview

> A resource timeline for planning people, crews, rooms and equipment, with drag and drop, resizing, drag-to-create, zoom presets, working time and time zones.

Birch UI Scheduler is a resource timeline. Resources (field technicians, installation crews, meeting rooms, vehicles) are listed down the left side, time runs left to right, and each event is a bar in its resource's row. Dispatchers drag jobs between people, stretch them to change the duration, and drag across empty time to book new work.

It is built on the same vanilla TypeScript engine as BirchUI Grid, so it has no framework dependency, renders only what is on screen in both directions, and follows the same widget contract as every other Birch UI component.

> **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 commercial product: a one-time purchase per developer with free updates forever, unlimited apps and unlimited end users. Without a license key every feature works and a small watermark is shown. On `localhost` the watermark is skipped while you develop.

**Live demo: Field service schedule** (runs on the HTML version of this page). Source of `demos/scheduler-basic.ts`. Imports from `./_shared` and `./_scheduler-data` are sample data and small UI helpers used only by the docs.

```ts
import { createScheduler, type ViewPresetName } from '@birchui/scheduler';
import { docsTheme, field, layout, onDocsThemeChange, button } from './_shared';
import { WEEK_START, at, serviceJobs, technicians, type ServiceJob, type Technician } from './_scheduler-data';

export const meta = { title: 'Field service schedule', height: 460 };

const PRESETS: ViewPresetName[] = ['hourAndDay', 'dayAndWeek', 'weekAndMonth', 'monthAndYear'];

export default function mount(el: HTMLElement): () => void {
  const { toolbar, body, status } = layout(el);
  const preset = document.createElement('select');
  for (const name of PRESETS) preset.add(new Option(name, name, name === 'hourAndDay', name === 'hourAndDay'));

  const end = new Date(WEEK_START);
  end.setDate(end.getDate() + 7);
  const scheduler = createScheduler<ServiceJob, Technician>(body, {
    resources: technicians,
    events: serviceJobs(),
    start: WEEK_START,
    end,
    viewPreset: 'hourAndDay',
    resourceColumns: [
      { field: 'name', header: 'Technician', width: 170 },
      { field: 'skill', header: 'Skill', width: 140 },
    ],
    workingTime: { days: [1, 2, 3, 4, 5], startHour: 8, endHour: 18 },
    readOnly: true,
    theme: docsTheme(),
    height: '100%',
    ariaLabel: 'Field service schedule',
  });

  const onPreset = () => scheduler.setViewPreset(preset.value as ViewPresetName);
  preset.addEventListener('change', onPreset);
  toolbar.append(
    field('View', preset),
    button('Zoom in', () => scheduler.zoomIn()),
    button('Zoom out', () => scheduler.zoomOut()),
    button('Monday 08:00', () => scheduler.scrollToDate(at(0, 8), 'start')),
  );
  const offs = [
    scheduler.on('eventClick', ({ event }) => {
      status.textContent = `${event.title} for ${event.customer}`;
    }),
    scheduler.on('viewPresetChanged', ({ preset: next }) => {
      status.textContent = `View preset: ${typeof next === 'object' && 'name' in next ? String(next.name) : 'custom'}`;
    }),
  ];
  status.textContent = 'Click a job to see its customer.';
  const stopTheme = onDocsThemeChange((theme) => scheduler.update({ theme }));
  return () => {
    preset.removeEventListener('change', onPreset);
    for (const off of offs) off();
    stopTheme();
    scheduler.destroy();
  };
}
```

## What it does

- **Resource rows** with optional hierarchy: group technicians under depots or rooms under floors with `parentId`, and collapse or expand groups.
- **Time axis presets** from 15-minute ticks to whole months, with two-row headers, `zoomIn()` and `zoomOut()`, and fully custom presets.
- **Drag, resize and drag-to-create** with snapping to minutes or to ticks, plus `validateDrop` and `validateResize` hooks to reject moves your business rules do not allow.
- **Overlap handling**: events that overlap in one row are laid out in lanes.
- **Working time**: non-working hours and days are shaded, and a "now" line marks the current time.
- **Time zones**: the whole timeline is computed in an IANA time zone through `Intl`, so a dispatcher in Chicago can plan a crew in Berlin on Berlin time, with correct daylight saving transitions.
- **Virtualization** of rows and time, so thousands of resources and long ranges stay fast.
- **Keyboard and screen reader support** for selecting, moving, resizing and removing events.

## Install

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

The package depends on `@birchui/core` and `@birchui/license`, which npm installs for you. Styles are injected automatically the first time a scheduler is created. If your Content Security Policy blocks inline styles, set `injectStyles: false` and import the stylesheet instead:

```ts
import '@birchui/scheduler/styles.css';
```

See [Installation](https://docs.birchui.com/getting-started/installation.md) for bundler notes that apply to every Birch UI package.

## Create a scheduler

`createScheduler(container, options)` renders into an element you own and returns the scheduler API. The required options are `resources` plus the visible range, `start` and `end`.

```ts title="dispatch-board.ts"
import { createScheduler } from '@birchui/scheduler';

const container = document.querySelector<HTMLElement>('#dispatch-board')!;

const scheduler = createScheduler(container, {
  resources: [
    { id: 'tech-amira', name: 'Amira Haddad' },
    { id: 'tech-jonas', name: 'Jonas Weber' },
    { id: 'tech-lucia', name: 'Lucía Romero' },
  ],
  events: [
    {
      id: 'job-4471',
      resourceId: 'tech-amira',
      title: 'Boiler service, Harbor View Apartments',
      start: '2026-12-07T08:00',
      end: '2026-12-07T10:30',
    },
    {
      id: 'job-4472',
      resourceId: 'tech-jonas',
      title: 'Heat pump install, Ortega residence',
      start: '2026-12-07T09:00',
      end: '2026-12-07T15:00',
      color: '#0f766e',
    },
    {
      id: 'job-4475',
      resourceId: 'tech-lucia',
      title: 'Annual inspection, Northgate Clinic',
      start: '2026-12-07T13:00',
      end: '2026-12-07T14:30',
    },
  ],
  start: '2026-12-07T06:00',
  end: '2026-12-07T20:00',
  viewPreset: 'hourAndDay',
  timeZone: 'America/Chicago',
  workingTime: { days: [1, 2, 3, 4, 5], startHour: 8, endHour: 17 },
  height: 420,
});

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

Strings such as `'2026-12-07T08:00'`, with no offset, are read as wall-clock time in the scheduler's `timeZone`. You can also pass `Date` objects or epoch milliseconds. [Resources and events](https://docs.birchui.com/scheduler/resources-and-events.md#dates-and-times) covers the rules.

> **Tip**
>
> Give the scheduler a size. Pass `height` (a number of pixels or any CSS length), or give the container a height in your own CSS. The time axis then scrolls inside it.

## The widget contract

Every Birch UI component, the scheduler included, returns an object with the same four members. Framework adapters are thin wrappers around this contract.

| Member | What it does |
| --- | --- |
| `element` | The root element the scheduler rendered. |
| `update(partial)` | Applies only the options you pass, without recreating the scheduler. |
| `on(event, listener)` | Subscribes to an event and returns an unsubscribe function. Payloads are always objects. |
| `destroy()` | Removes the DOM and releases every listener, observer and timer. |

```ts
scheduler.update({ viewPreset: 'dayAndWeek', start: '2026-12-07', end: '2026-12-14' });

const stop = scheduler.on('eventClick', ({ event, resource }) => {
  openJobPanel(event.id, resource?.name);
});

stop();
scheduler.destroy();
```

Beyond the contract, the API has methods for data (`setEvents`, `addEvent`, `updateEvent`, `removeEvent`, `setResources`), navigation (`setRange`, `zoomIn`, `zoomOut`, `scrollToDate`, `scrollToEvent`) and selection. The [API and events](https://docs.birchui.com/scheduler/api.md) page lists them all.

## Activate your license

Set the key once, before the first scheduler is created, or pass it per instance:

```ts
import { setLicenseKey } from '@birchui/license';

setLicenseKey(import.meta.env.VITE_BIRCHUI_LICENSE);
```

```ts
createScheduler(container, { ...options, licenseKey: 'LQ1.…' });
```

Keys are verified offline in the browser. Nothing is sent over the network, and a paid key never expires. See [Licensing and activation](https://docs.birchui.com/getting-started/licensing.md) for seat rules and the watermark.

## Use it in your framework

Each framework adapter ships the scheduler from a `/scheduler` subpath, so apps that only use the grid never load scheduler code.

Each example renders the same board, a working week of service jobs, and saves a job when it is dragged. `resources`, `jobs` and `saveJob` are your own data and persistence function.

**JavaScript**

```ts
import { createScheduler } from '@birchui/scheduler';

const scheduler = createScheduler(document.getElementById('dispatch-board')!, {
  resources,
  events: jobs,
  start: '2026-12-07',
  end: '2026-12-12',
  viewPreset: 'dayAndWeek',
  height: 480,
});

scheduler.on('eventDrop', ({ event, start, end, resourceId }) => saveJob(event.id, { start, end, resourceId }));
```

**React**

```tsx
import { BirchScheduler } from '@birchui/react/scheduler';

export function DispatchBoard({ resources, jobs }: DispatchBoardProps) {
  return (
    <BirchScheduler
      resources={resources}
      events={jobs}
      start="2026-12-07"
      end="2026-12-12"
      viewPreset="dayAndWeek"
      height={480}
      onEventDrop={({ event, start, end, resourceId }) => saveJob(event.id, { start, end, resourceId })}
    />
  );
}
```

**Vue**

```vue
<script setup lang="ts">
import { BirchScheduler } from '@birchui/vue/scheduler';
import type { SchedulerEvents } from '@birchui/scheduler';

defineProps<{ resources: Technician[]; jobs: ServiceJob[] }>();

function onEventDrop({ event, start, end, resourceId }: SchedulerEvents['eventDrop']) {
  saveJob(event.id, { start, end, resourceId });
}
</script>

<template>
  <BirchScheduler
    :resources="resources"
    :events="jobs"
    start="2026-12-07"
    end="2026-12-12"
    view-preset="dayAndWeek"
    :height="480"
    @event-drop="onEventDrop"
  />
</template>
```

**Angular**

```ts
import { Component, input } from '@angular/core';
import { BirchSchedulerComponent } from '@birchui/angular/scheduler';
import type { SchedulerEvents } from '@birchui/scheduler';

@Component({
  selector: 'app-dispatch-board',
  standalone: true,
  imports: [BirchSchedulerComponent],
  template: `
    <birchui-scheduler
      [resources]="resources()"
      [events]="jobs()"
      start="2026-12-07"
      end="2026-12-12"
      viewPreset="dayAndWeek"
      [options]="{ height: 480 }"
      (eventDrop)="onEventDrop($event)"
    />
  `,
})
export class DispatchBoardComponent {
  readonly resources = input.required<Technician[]>();
  readonly jobs = input.required<ServiceJob[]>();

  onEventDrop({ event, start, end, resourceId }: SchedulerEvents['eventDrop']) {
    saveJob(event.id, { start, end, resourceId });
  }
}
```

**Svelte**

```svelte
<script lang="ts">
  import { BirchScheduler } from '@birchui/svelte/scheduler';
  import type { SchedulerEvents } from '@birchui/scheduler';

  let { resources, jobs }: { resources: Technician[]; jobs: ServiceJob[] } = $props();

  function onEventDrop({ event, start, end, resourceId }: SchedulerEvents['eventDrop']) {
    saveJob(event.id, { start, end, resourceId });
  }
</script>

<BirchScheduler
  {resources}
  events={jobs}
  start="2026-12-07"
  end="2026-12-12"
  viewPreset="dayAndWeek"
  height={480}
  {onEventDrop}
/>
```

**Solid**

```tsx
import { BirchScheduler } from '@birchui/solid/scheduler';

export function DispatchBoard(props: DispatchBoardProps) {
  return (
    <BirchScheduler
      resources={props.resources}
      events={props.jobs}
      start="2026-12-07"
      end="2026-12-12"
      viewPreset="dayAndWeek"
      height={480}
      onEventDrop={({ event, start, end, resourceId }) => saveJob(event.id, { start, end, resourceId })}
    />
  );
}
```

**Web Component**

```html
<birchui-scheduler id="dispatch-board"></birchui-scheduler>

<script type="module">
  import { defineBirchScheduler } from '@birchui/element/scheduler';

  defineBirchScheduler();

  const board = document.getElementById('dispatch-board');
  board.options = {
    resources,
    events: jobs,
    start: '2026-12-07',
    end: '2026-12-12',
    viewPreset: 'dayAndWeek',
    height: 480,
  };

  board.addEventListener('event-drop', ({ detail: { event, start, end, resourceId } }) => {
    saveJob(event.id, { start, end, resourceId });
  });
</script>
```

Notes per adapter:

- **React and Solid**: options are props, events are `on…` props, and `ref` gives you the `SchedulerApi`.
- **Vue**: pass options as attributes (kebab-case names are converted to camelCase) or as an `options` object; attributes win. Events are kebab-case (`@event-drop`, `@viewport-scroll`). The component exposes `api`.
- **Angular**: `resources`, `events`, `start`, `end`, `viewPreset`, `theme` and `licenseKey` are inputs; everything else goes in `[options]`. Scheduler events are outputs of the same name, such as `(eventDrop)` and `(rangeChanged)`, and the `api` property returns the `SchedulerApi`.
- **Svelte**: every option is a prop, events are `on…` props, and `bind:api` gives you the `SchedulerApi`. Prefer the `birchScheduler` action, also exported from `@birchui/svelte/scheduler`, when you want to attach the scheduler to your own element.
- **Web Component**: `<birchui-scheduler>` has no per-option properties or attributes. Assign the whole `options` object (or call `set(key, value)` for one key) and listen for kebab-case `CustomEvent`s with the payload in `detail`. Because the scheduler is created as soon as the element is connected and has options, set `resources`, `start` and `end` together in one `options` assignment. Give the element `display: block` or a height in CSS.

The `/scheduler` entry points are the only code that imports `@birchui/scheduler`, so grid-only apps never load it. See [Using the Scheduler in your framework](https://docs.birchui.com/frameworks/scheduler.md) for SSR notes and complete examples.

## Next steps

- [Resources and events](https://docs.birchui.com/scheduler/resources-and-events.md): data shapes, hierarchy, dates and updating data.
- [View presets and zoom](https://docs.birchui.com/scheduler/view-presets.md): choose the time scale and build your own.
- [Drag, drop, resize and create](https://docs.birchui.com/scheduler/interactions.md): editing by pointer and keyboard, with validation.
- [Working time](https://docs.birchui.com/scheduler/working-time.md) and [time zones](https://docs.birchui.com/scheduler/time-zones.md).
- [Event rendering](https://docs.birchui.com/scheduler/event-rendering.md): colors, custom bar content and theming.
