API reference
ProScheduler props
The complete component surface, grouped by responsibility, followed by the options of each view and the imperative handle. Types mirror the package’s exported TypeScript definitions.
Imports
import {
ProScheduler,
type ProSchedulerProps,
type ProSchedulerInstance,
type SchedulerEvent,
type SchedulerResource,
type SchedulerView,
} from "@andreisaac/pro-scheduler"
// Types and locales, without the client boundary:
import { localeDe, type SchedulerEvent } from "@andreisaac/pro-scheduler/server"Data
What is scheduled, and on what. The scheduler reads these and never writes to them.
| Prop | Type | Default | Description |
|---|---|---|---|
dataRequired | SchedulerEventInput[] | — | The events to show. Controlled: apply the changes reported by the callbacks to update it. |
resources | SchedulerResource[] | [] | Rows of the timeline (or columns of the time grid with view.scheduler.resources), colours for their events, and options in the built-in editor. A resource with children is a collapsible group; see Resources for every field. |
viewRequired | SchedulerView | — | Which views to configure and their options. Several keys add a switcher to the header. |
defaultView | SchedulerViewType | first present | The view to open on. Without it, the first present key in the order calendar, timeline, scheduler, agenda opens. |
eventDensity | "dense" | — | Enable capped, virtualized defaults: three timeline lanes and an automatic time-grid stack cap. Explicit view options take precedence; overflow retains access to hidden events. |
Interaction
Which gestures are allowed and what they snap to.
| Prop | Type | Default | Description |
|---|---|---|---|
dragToMove | boolean | true | Drag events to another time (and resource, in the timeline). |
dragToResize | boolean | true | Drag an event’s edge to change its start or end. |
dragToCreate | boolean | true | Drag across empty space to draft a new event. |
clickToCreate | boolean | false | A single click on empty space drafts a new event (one hour in the time grid, one cell in the timeline). Without it a click only fires onCellClick. |
dragBetweenResources | boolean | true | Allow timeline events to change rows. |
eventDelete | boolean | true | Offer Delete in the built-in editor. |
dragTimeStep | number | 30 | Minutes that move, resize and create snap to, when the active view does not set its own. |
showDefaultEditor | boolean | true | Open the built-in create/edit dialog. When false, creation goes straight to onEventCreate and clicks only fire onEventClick. |
extendDefaultEvent | (draft: EventDraft) => Partial<SchedulerEvent> | — | Default fields merged into every event created through the UI. |
Rules and backgrounds
Checked before any callback; a refused change snaps back and reports why.
| Prop | Type | Default | Description |
|---|---|---|---|
invalid | PschInvalid[] | — | Blocked spans — absolute, whole days, or daily/weekly clock-time windows, optionally per resource. Nothing can be created, moved or resized into one. |
colors | PschColor[] | — | Shaded spans in the same shape, with background, cssClass, textColor and title. Visual only. |
eventOverlap | boolean | true | false refuses any change that overlaps another event of the same resource, buffers included. |
validationHorizon | { start: DateInput; end: DateInput } | current page | Finite half-open window for validated commits, including loaded conflicts beyond the page. Unbounded series are checked within this window; the host owns final validation. |
onValidationCoverage | (coverage: PschValidationCoverage) => void | — | Reports finite loading ranges visited, including a first-day range for off-page inputs. recurrenceLimits identifies windows made incomplete by recurrence work limits. |
onRecurrenceLimit | (diagnostic: PschRecurrenceDiagnostic) => void | — | Reports a complex recurrence's 200,000-period work limit. Simple daily and weekly counted rules fast-forward without that history scan. |
onEventCreateFailed | (failure: PschValidationFailure) => void | — | A create was refused: { event, reason: "invalid" | "overlap" | "permission", inputError?, invalid?, overlapping? }. Invalid input dates, reversed ends and buffers include inputError. |
onEventUpdateFailed | (failure: PschValidationFailure) => void | — | A move, resize or edit was refused; the event snapped back. |
Callbacks
Before-callbacks may return false to cancel; after-callbacks report the final event.
| Prop | Type | Default | Description |
|---|---|---|---|
onEventCreate | (draft: EventDraft) => boolean | void | — | A new event is about to be created. Return false to cancel. |
onEventCreated | (event, info?) => void | — | A new event was created (or split off a series; then it has no id). Add it to data. |
onEventUpdate | (event, info?) => boolean | void | — | An event is about to move, resize or be edited — for an occurrence, the occurrence as changed. Return false and it snaps back. |
onEventUpdated | (event, info?) => void | — | The updated event — your object with new start, end and resource (or a series with a new exception or end). Replace it in data. |
eventChangeDelivery | "events" | "transaction" | "events" | Choose ordered per-event notifications or one transaction notification. Transaction mode preserves before-hooks and suppresses the three per-event persistence callbacks. |
onEventTransaction | (change: PschEventTransaction, info?, context?) => void | — | Receives { created, updated, deleted } once per accepted operation or validated creation batch when transaction delivery is enabled. Apply the complete batch to controlled data and persistence. |
onEventDelete | (event, info?) => boolean | void | — | An event is about to be deleted. Return false to keep it. |
onEventDeleted | (event, info?) => void | — | An event was deleted. Remove it from data. info ({ mode, occurrence, originEvent }) is set when the change came from an occurrence. |
onEventClick | (event: SchedulerEvent) => void | — | An event was clicked (never fired by the click that ends a drag). |
onEventDoubleClick | (event: SchedulerEvent) => void | — | An event was double-clicked. onEventClick fires too; debounce if you need to tell them apart. |
onCellClick | ({ date, resource }) => void | — | Empty space was clicked, with the date (and resource) under the pointer. |
onCellHoverIn | ({ date, resource }) => void | — | The pointer entered an empty cell (a timeCellStep slot, or a timeline column of a row). Fires once per cell. |
onCellHoverOut | ({ date, resource }) => void | — | The pointer left the cell last reported by onCellHoverIn. |
onResourceCollapse | (resource, collapsed: boolean) => void | — | A resource group was expanded or collapsed (timeline). |
Rendering
Replace parts of the UI; everything not replaced keeps its default.
| Prop | Type | Default | Description |
|---|---|---|---|
renderHeader | () => ReactNode | default header | The navigation bar. Compose it from CalendarNav, CalendarPrev, CalendarNext, CalendarToday, ViewSwitcher, ViewLengthSelect and ZoomControl, or read useScheduler(). |
renderEventContent | (data: PschCalendarEventData) => ReactNode | — | The inside of every event, keeping the default block, colour and handles. |
renderEvent | (data: PschCalendarEventData) => ReactNode | — | The whole event element in every view. |
renderTimelineEvent | (data: PschCalendarEventData) => ReactNode | renderEvent | The whole event element, timeline only. |
renderSchedulerEvent | (data: PschCalendarEventData) => ReactNode | renderEvent | The whole event element, time grid only. |
renderAgendaEvent | (data: PschCalendarEventData) => ReactNode | renderEvent | The whole list item, agenda only. |
renderResource | (resource: SchedulerResource) => ReactNode | the name | The content of each timeline row’s label cell. |
renderResourceHeader | () => ReactNode | “Resources” | The heading above the resource column. |
renderSidebar | (resource: SchedulerResource) => ReactNode | — | Timeline: a right-hand column with a cell per row. |
renderSidebarHeader | () => ReactNode | — | Timeline: the heading above the right-hand column. |
renderDayFooter | ({ date, events }) => ReactNode | — | Timeline: a cell under each axis column; events are those overlapping it, across all rows. |
renderResourceFooter | () => ReactNode | — | Timeline: the bottom-left corner under the resource column. The footer strip shows when this or renderDayFooter is set. |
renderDay | ({ date }) => ReactNode | — | Day headings in the time grid and timeline, and day cells in the calendar. renderHour, renderWeek, renderMonth and renderYear are aliases. |
renderEventTooltip | (data: PschCalendarEventData) => ReactNode | title and time | The hover card on events in the time grid and timeline. Return null for none on that event. |
showEventTooltip | boolean | true | false turns every event tooltip off. |
renderAgendaDay | ({ date, events, isToday }) => ReactNode | weekday and date | Agenda: each day's heading. |
renderAgendaEmpty | () => ReactNode | "No events" | Agenda: what an empty page shows. |
recurringEditMode | "ask" | "current" | "following" | "all" | "ask" | What an edit or delete of one occurrence applies to; "ask" prompts. |
dataTimezone | string (IANA) | browser | Zone that floating times in data (no offset) are read in, and that series repeat in. |
displayTimezone | string (IANA) | browser | Zone every view shows times in; today and the current-time line follow it. |
dir | "ltr" | "rtl" | "auto" | "auto" | Text direction; "rtl" mirrors every view. "auto" follows the page. |
min / max | DateInput | — | Bounds for navigation and editing; time outside is blocked. max is inclusive (a midnight date includes that day). |
onVirtualLoading | ({ startIndex, endIndex, resources, firstDay, lastDay }) => void | — | Timeline: the rendered rows and dates changed — load their events, or more resources near the end. |
selectMultipleEvents | boolean | false | Clicks select events (double click edits); Delete removes the selection, Escape clears it. |
selectedEvents | SchedulerEvent[] | — | The selection, controlled. |
dragSelectedEvents | boolean | false | With selectMultipleEvents, drag a selected group back-to-back in time grids and timed timelines. Whole-group validation; recurring edits affect selected occurrences only. |
onSelectedEventsChange | (events) => void | — | The selection changed. |
onEventsDelete | (events) => boolean | void | — | Before the selection is deleted; false keeps it. onEventDeleted then fires per event. |
externalDrop | boolean | false | Accept ExternalDraggable items and events dragged out of other schedulers. |
externalDrag | boolean | false | Let events be dragged out to an ExternalDropZone or another scheduler; an accepted drop removes them here. |
onExternalDropOnEvent | ({ event, data }) => void | — | Something dragged in was dropped onto an event. |
onEventDragLeave / onEventDragEnter | (event) => void | — | With externalDrag: a dragged event crossed the scheduler's edge. |
resourceReorder | boolean | false | Timeline: drag rows by a grip to reorder them among their siblings. |
onResourceOrderChange | ({ resources, resource, parent, index }) => void | — | The new resource tree after a reorder. |
links | PschLink[] | — | Timeline: dependency arrows { from, to, type?, color? } between event ids. |
onLinkClick | (link) => void | — | A dependency arrow was clicked. |
eventOrder | (a, b) => number | by start | Order of overlapping events: top lanes in the timeline, left in the time grid, first in calendar and agenda days. |
renderCell | ({ date, resource }) => ReactNode | — | Content drawn in every empty cell under the events. Renders once per visible cell; keep it light. |
Appearance and language
Size, styling hooks and locale.
| Prop | Type | Default | Description |
|---|---|---|---|
height | number | string | 600 | Height of the scheduler; views scroll inside it. |
width | number | string | — | Width of the scheduler. |
className | string | — | Classes for the outer element. cssClass is an alias. |
styleConfig | SchedulerStyleConfig | see Sizing | Row, lane, hour and column measurements. |
themeVariant | "light" | "dark" | "auto" | "auto" | "dark" forces dark tokens on this scheduler; otherwise a dark class on an ancestor decides. |
locale | SchedulerLocale | localeEn | Language, date formatting and first day of the week. |
Completion and compatibility options
New behavior is explicit; controlled data and native callback arguments remain.
| Prop | Type | Default | Description |
|---|---|---|---|
viewMode | switch | combined | switch | Combined stacks configured calendar/timeline/scheduler/agenda and shares navigation/selection; defaultView or configured key order chooses its primary. |
responsive | Record<string, PschResponsiveOptions> | — | Container-width breakpoints; highest matching entry overrides base. view replaces; styleConfig merges. Standard widths: 0/576/768/992/1200. |
pageAnchorDate | DateInput | — | Fixed alignment for multi-period pages; refDate remains current navigation. |
ruleResolution | legacy | specific | legacy | Legacy false vetoes; specific resolves event → resource → global, retaining event locks. |
dragInTime / dragBetweenSlots | boolean | true | Global movement policies; resource/event overrides follow ruleResolution. |
dragTimeStepBase | dayStart | viewStart | legacy | Explicit snap origin shared by creation, movement and resizing. |
invalidateEvent | strict | start-end | strict | Any invalid intersection, or only invalid start/end boundaries. |
exclusiveEndDates | boolean | true | False converts inclusive input/output ends; internal intervals stay half-open. |
generateEventIds / broadcastUnassignedEvents | boolean | false | Opt-in IDs on immutable copies and unassigned-resource broadcasting. Empty resource arrays stay distinct. |
labels / marked | PschCalendarLabel[] / (PschCalendarMark | DateInput)[] | — | Independent recurring, styled calendar annotations; labels deliver onLabelClick. |
actionableEvents | boolean | true | Disable native interactive list wrappers for custom agenda/overflow content. |
context | string | HTMLElement | body | Popup portal container selector or element. |
showControls / showEventBuffer | boolean | true | Control visibility; hidden buffers still participate in conflicts. |
connections / groupBy / rtl | PschConnection[] / date | resource / boolean | — | Migration aliases; explicit links, nested scheduler groupBy and dir win. |
slots | PschSlot[] | — | Daily timeline listing slots; missing assignments appear in each. Movement enabled, creation/resizing disabled. |
resourceReorderMode | siblings | tree | siblings | Tree mode allows reparenting with cycle prevention; fixed and reorder false resources are protected. |
externalResourceDrag / externalResourceDrop | boolean | false | Cross-instance resources use cancellable before hooks and controlled completion callbacks. |
zoomLevelsByKey / zoomLevel / onZoomLevelChange | Record<string,PschZoomLevel> / string | number / callback | — | Named configurations and controlled zoom; numeric methods and arrays remain. |
calendarSystem | PschCalendarSystem | Gregorian | Optional Jalali/Hijri adapters imported from separate calendars/jalali or calendars/hijri paths. |
themeVariant | auto | system | light | dark | auto | Auto inherits host; system explicitly follows system color preference. |
External drag components
| Interface | Type | Behavior |
|---|---|---|
| ExternalDraggable.event / events | PschExternalEvent / readonly PschExternalEvent[] | Provide exactly one. Arrays pack in input order; duration is in minutes. |
| makeDraggable(element, data) | event | readonly event[] | (() => event | readonly event[]) | Returns cleanup. Supports native dragging from a DOM element. |
| ExternalDropZone.onDrop | (event: SchedulerEvent) => boolean | void | Receives a single event; false refuses the drop. |
| ExternalDropZone.onEventsDrop | (events: SchedulerEvent[]) => boolean | void | Required for group drops. Receives the whole group once; false refuses all. Also handles singles when onDrop is absent. |
Render arguments
type PschCalendarEventData = {
original: SchedulerEvent // your event, untouched
title: string
start: Date
end: Date // equals start for a point-in-time event
resource?: string | number
color?: string // event colour, else its resource's
isMultiDay: boolean
}
type EventDraft = { start: Date; end: Date; resource?: string | number; title?: string }View options
Each key of view takes its own options. See Views for how they combine.
view.timeline
Resources down the side, time across.
| Prop | Type | Default | Description |
|---|---|---|---|
type | "day" | "week" | "month" | "year" | "custom" | "month" | The span of one page. |
size | number | 1 | How many spans one page shows. |
range | { start, end } | — | With type "custom": the window to show. Pages are as long as the range and move by its length. |
resolutionHorizontal | "hour" | "day" | "week" | "month" | "quarter" | "year" | by type | The unit of one axis column: hours for a day (or a custom range up to 3 days), months for a year, days otherwise. |
timeCellStep | number | 60 | Minutes per column at hour resolution. |
unitWidthPx | number | styleConfig | Column width for this view. |
startDay / endDay | number (0–6) | 0 / 6 | The weekdays that get columns. |
startTime / endTime | "HH:MM" | "00:00" / "24:00" | The hours that get columns; day columns cover just these hours. |
weekNumbers | boolean | false | A header tier of week numbers over day and hour columns. |
zoomLevels | PschZoomLevel[] | — | Zoom steps ({ resolutionHorizontal, timeCellStep?, unitWidthPx, label? }) for ZoomControl and the zoom methods. |
zoomLevel | number | 0 | The zoom step to start at. |
currentTimeIndicator | boolean | true | Draw a line at the current time. |
dragTimeStep | number | prop / 30 | Snap step in minutes for this view. |
maxEventStack | number | all | auto | "all" | Stacked events per row before the rest go behind a "+N more" chip per column. |
rowHeight | "variable" | "equal" | "variable" | "equal" makes every row as tall as the tallest. |
groupSummary | boolean | false | Group rows show their descendants' events, faded and read-only. |
panelDragNavigate | boolean | false | Swipe sideways to page. Engages only when the axis fits without scrolling and dragToCreate is off. |
view.scheduler
Days across, hours down.
| Prop | Type | Default | Description |
|---|---|---|---|
type | "day" | "week" | "month" | "custom" | "week" | The span of one page. |
size | number | 1 | How many spans one page shows. |
range | { start, end } | — | With type "custom": the days to show; pages move by the range's length. |
weekNumbers | boolean | false | The week number in the corner above the time gutter. |
weekStrip | boolean | false | A week strip above the grid for picking the day (a mobile day view). |
startDay / endDay | number (0–6) | 0 / 6 | The weekdays to show; 1 and 5 for a working week. |
startTime / endTime | "HH:MM" | "00:00" / "24:00" | Visible hours. endTime may exceed 24:00 to run into the next day. |
timeCellStep | number | 60 | Minutes per grid cell. |
timeLabelStep | number | 60 | Minutes per time label. |
dragTimeStep | number | prop / 30 | Snap step in minutes for this view. |
periods | { start, end, label? }[] | — | Fixed periods (a school bell): labels and lines follow them, the gaps between are shaded, and move, resize, create and drops snap to them instead of dragTimeStep. |
allDay | boolean | true | Show the all-day strip. |
currentTimeIndicator | boolean | true | Draw a line at the current time. |
cursorTime | boolean | false | Show a line and time label following the pointer. |
gridLines | "both" | "horizontal" | "vertical" | "none" | "both" | Which grid lines to draw. |
fitToHeight | boolean | false | Fit the whole time range into the available height. |
eventHeight | "duration" | "auto" | "duration" | "auto" pins events at their start and sizes them to their content (resize off). |
resources | boolean | false | Split each day into a column per (leaf) resource, with a second header row. |
timezones | (string | { timezone, label? })[] | — | Extra time columns beside the gutter showing the rows' times in other zones. |
groupBy | "date" | "resource" | "date" | With resources: the resources under each day, or the days under each resource. |
maxEventStack | number | all | auto | "all" | Side-by-side events per overlap group before a "+N more" chip. |
panelDragNavigate | boolean | false | Swipe empty space sideways to page. |
view.agenda
A list grouped by day. Beside calendar, it lists the selected day.
| Prop | Type | Default | Description |
|---|---|---|---|
type | "day" | "week" | "month" | "year" | "month" | The span of one page. |
size | number | 1 | How many spans one page shows. |
showEmptyDays | boolean | false | List days that have no events. |
scrollable | boolean | true | false: the list grows to fit (use height="auto") and the page scrolls. |
view.calendar
A grid of days.
| Prop | Type | Default | Description |
|---|---|---|---|
type | "month" | "week" | "month" | A full month, or a single week row. |
size | number | 1 | Spans to step by when paging. |
weekNumbers | boolean | false | A column of week numbers before each week. |
labels | boolean | number | auto | all | false | Show events as bars across their days: true for up to 3 per day, or a number; the rest go behind "+N more". Without it, a count per day. |
panelDragNavigate | boolean | false | Swipe the grid sideways to page. |
Additional view options
See the feature-completion example for every renderer surface and controlled resource transfers.
| Prop | Type | Default | Description |
|---|---|---|---|
calendar | PschCalendarView | — | year/multi-period size; count/outerDays; exact/fill; labels auto/all; popover/popoverClass; horizontal/vertical scroll. Editing requires eventInteraction true. |
scheduler | PschScheduleView | — | dayHeader, empty/invalid column filtering, maxEventStack auto/minEventWidth (100px); virtualScroll opt-in. |
timeline | PschTimelineView | — | eventHeight variable/equal; empty/invalid row filtering; vertical days; exact/fill listing; timeLabelStep; minute cells; shifted windows; named columnWidth; virtualScroll defaults true. eventList is deprecated. |
callbacks | SchedulerCallbacks | — | Lifecycle, cell/event/resource gestures, drag, annotation and resource CRUD/order hooks. Existing arguments keep optional trailing interaction context. |
renderers | SchedulerRenderProps | — | Per-view full → generic full → per-view content → generic content → built-in. Date fields remain; formatted dates/resource/slot/segment/selection enrich context. |
Imperative handle
Pass a ref to reach the scheduler from outside. The methods that change events do not change them directly — they fire the same callbacks as the UI, so your state remains the only source of truth.
const scheduler = useRef<ProSchedulerInstance>(null)
<ProScheduler ref={scheduler} … />
scheduler.current?.setView("agenda")
scheduler.current?.navigateToEvent(nextBooking)| Method | Signature | Does |
|---|---|---|
| navigate(date) | (date: Date) => void | Show the page containing the date and select it. |
| getSelectedDate() | () => Date | The selected day. |
| setSelectedDate(date) | (date: Date) => void | Same as navigate. |
| getView() | () => SchedulerViewType | The active view key. |
| setView(view) | (view: SchedulerViewType) => void | Switch to another configured view. |
| getEvents(start?, end?) | (start?: Date, end?: Date) => SchedulerEvent[] | Events overlapping the range, or all of data. |
| addEvent(event, options?) | (SchedulerEventInput | SchedulerEventInput[], {validate?: boolean}?) => void | Fires onEventCreated for each — add them to data there. |
| updateEvent(event, options?) | (event, {validate?: boolean}?) => void | Fires onEventUpdated. |
| removeEvent(idOrEvent, options?) | (id | event, {validate?: boolean}?) => void | Fires onEventDeleted. |
| navigateToEvent(event) | (event) => void | Reveal the event’s date, time and resource, expanding ancestors. |
| zoomIn() / zoomOut() | () => void | Step through view.timeline.zoomLevels, keeping the middle of the view in place. |
| setZoom(level) | (level: number) => void | Go to a zoom level (an index into zoomLevels, clamped). |
| getZoom() | () => number | The current zoom level. |
| getVisibleEvents() | () => SchedulerEvent[] | Events in visible configured ranges and resource layouts. |
| getEventsInRange(start, end?) | (DateInput, DateInput?) => SchedulerEvent[] | Expanded occurrences overlapping [start,end); single dates cover a complete display-zone day. |
| getInvalids(start?, end?) | (DateInput?, DateInput?) => PschInvalid[] | Expanded invalid intervals, or the current page. |
| getViewDate() | () => Date | First day of the primary view. |
| getZoomLevel() / setZoomLevel(level) | () => number | string / (number | string) => void | Named or numeric zoom configuration. |
| addResource / removeResource / reorderResource | (...) => boolean | Cancellable controlled resource changes; completion delivers proposed trees. |
| print() | () => void | Print the scheduler alone: every row and column, at full height. |