Resource Scheduler

Pro

Resources against time: rooms, people or equipment in rows (timeline day, week and month) or columns (resource day), grouped into collapsible trees. Bookings sit in lanes so a double booking is never hidden; working hours are shaded and blocked time hatched; `overlapRule` warns about or prevents double bookings. Drag, tap or press Enter on free time to book it — the booking rules answer first, by name. With `editable`, a booking drags to another time, day or resource and its end edge drags to resize, or moves from the keyboard (Space, arrows, Space); every drop asks the same rules as the edit dialog, then the host's `canMoveEvent`, and is refused out loud when either says no. Every booking is at least a 24 px target, however short. Same `CalendarEvent`s as `sv-event-calendar`, recurring series and zones included.

</>sv-scheduler schedulerresourcestimelinebookingroomsrota

Complexity tier: Application The interactive bar, plus a stated data-volume ceiling, a persistence contract, a bundle budget and an accessible parity surface.

import { SvSchedulerComponent } from '@styloviz-pro/scheduler';

Demo & usage

Basic usage

Pro

Usage example — open the gallery for the full interactive demo.

Pro

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Let a browser agent drive it (WebMCP)

Pro

Booking rules

Pro

Drag, resize and keyboard moves

Pro

Wired to an API

Pro

When to use

  • Booking shared things — rooms, vehicles, equipment — or rota-ing people, where WHO or WHAT matters as much as when.
  • For one person's calendar, use `sv-event-calendar`; for task dependencies over weeks, use the Gantt chart.

Async states

  • loading
  • error
  • retry

Inputs

NameTypeDefaultDescription
resourcesreadonly SvSchedulerResource[][]What can be booked. A resource others name as `parentId` is a group.
eventsreadonly CalendarEvent[][]Bookings for the visible range — each names its `resourceIds`. Fetch them from `rangeChange`.
loadingbooleanfalseTrue while the range is being fetched.
errorSvDataError | string | nullnullLoad failure — normalise an `HttpErrorResponse` with `toSvDataError()`.
viewSvSchedulerView (two-way)'timeline-week'The active view. Two-way bindable.
viewsreadonly SvSchedulerView[]['resource-day', …, 'timeline-month']The views the switcher offers, in order.
focusedDatestring (two-way)svDateKey(new Date())The date the view is centred on, `YYYY-MM-DD`. Two-way bindable.
collapsedreadonly string[] (two-way)[]Ids of collapsed groups (timeline views). Two-way bindable, so a host can persist it.
localestringsvLocale()BCP 47 locale.
weekStart0 | 1 | 2 | 3 | 4 | 5 | 61First weekday, `0` Sunday to `6` Saturday.
timeZonestring | nullnullThe IANA zone times are shown in; `null` draws every time as given.
dayStartstring'08:00'The first hour drawn, `HH:MM`.
dayEndstring'18:00'The last hour drawn, `HH:MM`.
slotMinutesnumber30Slot length in minutes for the day views, 5 or more.
showZonePolicybooleantrueShow the zone line under the grid.
workingHoursSvWorkingHours | nullSV_DEFAULT_WORKING_HOURSThe hours shaded as working time; a resource's own `workingHours` wins. `null` shades nothing.
blockedreadonly SvBlockedInterval[][]Time nothing can be booked into — hatched on the grid, refused with its label.
overlapRuleSvOverlapRule'warn'A second booking of one resource at once: `'allow'`, `'warn'` (books, names the clash) or `'prevent'`.
creatablebooleanfalseDrag, tap or press Enter on free time to book it (`slotSelect`).
eventDialogbooleantrueOpen the event details dialog when a booking is activated. `eventClick` still fires.
editablebooleanfalseLet the dialog change a booking's date and times, and delete it; with `eventDrag`, bookings also drag.
eventDragbooleantrueWith `editable`, a booking drags to another time, day or resource, its end edge drags to resize it (single-day views), and Space picks it up to move from the keyboard. Every drop is judged like the dialog's Save and emitted as `eventChange`. `false` keeps editing to the dialog.
canMoveEventSvEventMoveGuard | nullnullThe host's say on every move — drag, keyboard, the dialog's Save and `requestEventChange` — asked after the booking rules allow it: `true` lets it through, `false` or a reason refuses it (`eventMoveRefused`). Asked on every step of a drag, so keep it cheap.

Outputs

EventPayload typeDescription
retryvoidThe host should re-run the failed load.
rangeChangeCalendarRangeThe visible dates changed — fetch their events. Emitted on first render and on every real change.
eventClickCalendarEventA booking was activated.
slotSelectSvSlotSelectionFree time the booking rules allow was picked — create the event.
eventChangeSvEventChangeThe dialog, a drag or a keyboard move changed a booking (`source` says which) — `events = svApplyEventChange(events, $event)`.
eventMoveRefusedSvEventMoveRefusalA move or an edit was refused — read-only, the booking rules, or `canMoveEvent`. Emitted INSTEAD of `eventChange`; nothing moved.
eventRemoveSvEventRemovalThe dialog deleted a booking — `events = svApplyEventRemoval(events, $event)`.
viewChangeSvSchedulerViewEmits the new `view` whenever it changes — the output half of `[(view)]`.
focusedDateChangestringEmits the new `focusedDate` whenever it changes — the output half of `[(focusedDate)]`.
collapsedChangereadonly string[]Emits the new `collapsed` whenever it changes — the output half of `[(collapsed)]`.

Wire it to your API

This component is headless about transport: it renders what you give it and reports what the user asks for. Nothing below requires @styloviz/data — drive it from whatever you already use.

Template

Pro

Bound to the names this component actually exposes.

Host class

Pro

Drive the three async inputs from your own fetch.

  • This component does not emit a query, so it renders what you give it. Call `load()` on your own trigger and bind `events`, `loading` and `error`.
  • Normalize failures with `toSvDataError()` from `@styloviz/core`. It derives `retryable` from the status, so a 404 does not get a "Try again" button that can only fail again.

Full walkthrough: Connecting to a backend.

Customization & theming

  • Four views: `resource-day`, `timeline-day`, `timeline-week`, `timeline-month`; `views` picks which the switcher offers.
  • Moving: with `editable`, drag a booking to move it (by `slotMinutes`, or by whole days in the week and month timelines) and across resources; drag its end edge to resize it in the single-day views. `eventDrag` turns drag and keyboard moves off; `canMoveEvent` refuses a move with a reason; `readOnly` on an event locks it. A recurring booking moves one occurrence, as the dialog does by default; open it to move the series.
  • `dayStart` / `dayEnd` set the hours drawn (08:00–18:00 by default) and `slotMinutes` the slot size (30). A booking outside the hours is pinned to the edge with a marker, never dropped.
  • Resources nest through `parentId`; `collapsed` is a two-way model of the folded groups, so a host can persist it.
  • A resource's own `workingHours` wins over the scheduler's.

Best practices

  • Do: Give each event the `resourceIds` it books; an event booking two people is drawn in both rows and clashes in both.
  • Do: Put real unavailability in `blocked` (maintenance, holidays, breaks) — it refuses bookings with its label. Use `workingHours` for the ordinary day; outside it is a warning, never a refusal.
  • Don't: Do not create the event in the component and hope: `slotSelect` only reports a slot the rules allow, and your backend still has the last word.
  • Do: Put rules the scheduler cannot know — a buffer, minimum notice, who may move what — in `canMoveEvent`, and handle `eventChange` once: a drag, a keyboard move and the dialog arrive the same way, so the save (optimistic, with a rollback) is written once. Mark what must not move `readOnly`.

Accessibility

  • Without `creatable` the scrolling schedule is itself a labelled `region` and tab stop, so the arrow keys scroll it to any hour; with `creatable` the slot grid is the stop and arrowing along it scrolls.
  • The free slots are one tab stop, roving like a grid: arrow keys along and across, Home / End to the ends; Enter or Space books the focused slot. Each slot is named with its resource, date and time, and a blocked one says so with `aria-disabled`. Time under a booking is not a slot: the tab stop lands on the first free one and the arrows step over bookings, so no focus ring is ever hidden behind one.
  • Every booking is at least 24 × 24 CSS px (WCAG 2.5.8), however short — the box is padded and the lanes are laid out on the padded boxes, so a short booking never covers its neighbour.
  • Every move has a keyboard path (WCAG 2.5.7): focus a booking, Space picks it up, the arrows move it along time and across resources, Shift and an arrow change its end, Space or Enter drops, Escape cancels. Each step is said in a live region; a refused drop is said there and in the status line, in words. Touch lifts a booking on a long press, so a finger still pans the grid.
  • Every booking is a button named with its title, time, rule, zone and what it books; each resource's bookings are a list named "Bookings for …".
  • A refused or warned booking is said in a polite live region, in words — "Lunch — nothing can be booked then.", "It would overlap Design review, …".
  • Groups collapse through a real button with `aria-expanded`. Touch never starts a drag-to-book, so a finger can pan the grid; a tap books one slot (WCAG 2.5.7).

Feedback on Resource Scheduler

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.