Birch UI v0.1
Pricing

Undo and redoScheduler

Record moves, resizes, creates and removals in the scheduler, undo them with Ctrl+Z, and save undone changes from historyChange.

Open .md

The scheduler records every change to its events: drags, resizes and keyboard deletes, and the addEvent, updateEvent and removeEvent calls, including the two-part change of a recurring occurrence.

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

const scheduler = createScheduler(el, {
  resources: technicians,
  events: jobs,
  start: '2026-11-23',
  end: '2026-11-30',
  undoRedo: { limit: 200 },
});

Undo is on by default and keeps the last 100 changes. { limit } keeps another number of changes, and undoRedo: false (or { limit: 0 }) turns history off, in which case historyChange does not fire. Any other value logs one warning and keeps the default.

UndoRedoOptionsinterface@birchui/schedulerFull reference
PropertyTypeDescription
limitoptionalnumber—

Keys and methods#

Ctrl+Z (⌘+Z) undoes, and Ctrl+Shift+Z or Ctrl+Y redoes, while focus is inside the scheduler and it is not readOnly.

SchedulerApiinterface@birchui/schedulerFull reference
MemberTypeDescription
undo()() => boolean—
redo()() => boolean—
canUndo()() => boolean—
canRedo()() => boolean—
clearHistory()() => void—

setEvents() and update({ events }) start a new history, because the events they load are a new baseline.

Saving undone changes#

Undo and redo do not fire eventDrop, eventResize or eventRemove again. Every change, including undo and redo, is reported by historyChange:

Field Meaning
action 'record' for a new change, 'undo', 'redo', or 'clear' when the history is reset
kind 'move', 'resize', 'add', 'update' or 'remove', or null for 'clear'
changes { id, before, after } for every event touched; before is null for a created event and after is null for a removed one
canUndo, canRedo The new availability, for toolbar buttons
TypeScript
scheduler.on('historyChange', ({ action, changes, canUndo, canRedo }) => {
  undoButton.disabled = !canUndo;
  redoButton.disabled = !canRedo;
  if (action !== 'undo' && action !== 'redo') return;
  for (const { id, after } of changes) {
    if (after) void jobs.save(after);
    else void jobs.remove(id);
  }
});

If you already save from eventDrop and friends, save only undo and redo from historyChange as above. If you start fresh, save everything from historyChange and nothing else.

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