Features
Drag, resize and create
Move events between times and resources, resize either edge, and draw new ones on empty space — each snapped to a step you choose and vetoable before it lands.
Gestures
| Gesture | Timeline | Time grid |
|---|---|---|
| Drag an event | Earlier / later, and to another resource row | Another time or day; past midnight into the next day |
| Drag an edge | Left or right edge | Top or bottom edge |
| Drag on empty space | Creates across the dragged range | Creates down the dragged range |
| Click an event | Opens the editor | Opens the editor |
| Swipe the panel (panelDragNavigate) | Previous / next period | Previous / next period |
While dragging, a dashed ghost stays at the original position and a live label shows the time the event will land on. A plain click is never mistaken for a drag, and the click that ends a drag does not open the editor.
<ProScheduler
dragToMove // default true
dragToResize // default true
dragToCreate // default true
clickToCreate={false} // default false: a single click on empty space creates
dragBetweenResources // default true: timeline events may change rows
eventDelete // default true: the editor offers Delete
dragTimeStep={30} // minutes; a view's own dragTimeStep wins
…
/>Validating a change
The before callbacks run first and receive the proposed event. Return false and the change is abandoned — the event snaps back and the matching after callback does not fire. Anything else lets it through.
<ProScheduler
data={events}
view={view}
onEventUpdate={(event) => {
// Client-facing reviews are fixed.
if (event.kind === "Review") return false
}}
onEventCreate={(draft) => draft.start.getHours() >= 8}
onEventDelete={(event) => confirm(`Delete "${event.title}"?`)}
onEventUpdated={(event) => setEvents((list) => list.map((e) => (e.id === event.id ? event : e)))}
/>Reviews are locked
Move a session, try to move a client review, and read what the callbacks reported.
import { useMemo, useState, useSyncExternalStore } from "react"
import { ProScheduler, type SchedulerEvent } from "@/components/pro-scheduler"
import { studioResources, studioSessions, type StudioEvent } from "@/lib/demo-data/studio"
const subscribe = () => () => {}
/** False during the server render and hydration, true afterwards. */
function useHydrated() {
return useSyncExternalStore(subscribe, () => true, () => false)
}
function Placeholder({ height }: { height: number }) {
return <div aria-hidden className="docs-demo__placeholder" style={{ height }} />
}
/**
* ProScheduler is controlled: it never edits `data` itself. The callbacks below
* are the whole contract — apply the change, and the view re-renders from it.
*/
function useEvents(initial: () => SchedulerEvent[]) {
const [events, setEvents] = useState(initial)
const handlers = useMemo(
() => ({
onEventCreated: (event: SchedulerEvent) =>
setEvents((list) => [...list, { ...event, id: crypto.randomUUID() }]),
onEventUpdated: (event: SchedulerEvent) =>
setEvents((list) => list.map((e) => (e.id === event.id ? event : e))),
onEventDeleted: (event: SchedulerEvent) =>
setEvents((list) => list.filter((e) => e.id !== event.id)),
}),
[]
)
return { events, setEvents, handlers }
}
export function InteractionDemo() {
const hydrated = useHydrated()
const { events, handlers } = useEvents(studioSessions)
const [log, setLog] = useState<string[]>([])
const note = (line: string) => setLog((lines) => [line, ...lines].slice(0, 6))
if (!hydrated) return <Placeholder height={560} />
const time = (value: SchedulerEvent["start"]) =>
new Date(value).toLocaleString(undefined, { weekday: "short", hour: "2-digit", minute: "2-digit" })
return (
<div className="docs-demo__stack">
<ProScheduler
data={events}
resources={studioResources}
view={{ scheduler: { type: "week", startTime: "08:00", endTime: "18:00", dragTimeStep: 30 } }}
height={520}
// Reviews are client-facing and locked in place: returning false from
// a before-callback cancels the change and the event snaps back.
onEventUpdate={(event) => {
if ((event as StudioEvent).kind === "Review") {
note(`Blocked: "${event.title}" is a client review`)
return false
}
}}
onEventUpdated={(event) => {
note(`Moved "${event.title}" → ${time(event.start)}`)
handlers.onEventUpdated(event)
}}
onEventCreated={(event) => {
note(`Created "${event.title}" at ${time(event.start)}`)
handlers.onEventCreated(event)
}}
onEventDeleted={(event) => {
note(`Deleted "${event.title}"`)
handlers.onEventDeleted(event)
}}
/>
<ol className="docs-demo__log" aria-live="polite">
{log.length ? log.map((line, i) => <li key={i}>{line}</li>) : <li>Drag, resize or create an event…</li>}
</ol>
</div>
)
}// What a callback receives: the event you passed in, with its new times
// (and resource, when it moved rows). Every other key is kept as-is.
const updated: StudioEvent = {
id: "s-2",
title: "Location scout",
client: "Harbor Coffee",
kind: "Travel",
resource: "ada",
start: new Date("2026-09-28T12:00:00"), // was 11:00
end: new Date("2026-09-28T15:00:00"), // was 14:00
}
type SchedulerEventId = string | number
type ResourceId = string | number
/** Accepts Date | ISO string | epoch ms; normalized to Date via {@link toDate}. */
type DateInput = Date | string | number
/** Everything an event has but its start (shared with dragged-in events). */
interface SchedulerEventFields {
cssClass?: string
cellCssClass?: string
textColor?: string
tooltip?: string
order?: number
timezone?: string
slot?: SlotId
dragBetweenResources?: boolean
dragBetweenSlots?: boolean
recurringExceptionRule?: PschRecurrence | string
id?: SchedulerEventId
title: string
/** Omit for point-in-time events: they are pinned at `start`, never resizable,
* and (in the scheduler view's auto mode) overlap-packed by rendered height. */
end?: DateInput
/** The resource it's booked on — or several, for a shared event (a meeting
* with three people shows in each of their rows or columns). */
resource?: ResourceId | ResourceId[]
color?: string
allDay?: boolean
/** Set false to lock this event: it renders but can't be moved or resized. */
editable?: boolean
/** Set false to keep the duration fixed: the event moves but can't be resized. */
resize?: boolean
/** Set false so moving can't change the time — only the resource (timeline).
* In the time grid, where a move always changes the time, the event is fixed. */
dragInTime?: boolean
/** Set false so moving can't change the resource — only the time. */
resourceEditable?: boolean
/** Minutes kept free before / after the event (travel, set-up, cleaning).
* Drawn as a hatched band, and counted when `eventOverlap` is false. */
bufferBefore?: number
bufferAfter?: number
/** Set false to refuse any overlap with this event, whatever `eventOverlap` says. */
overlap?: boolean
/** Repeat the event: a rule object, or an RRULE string such as
* "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=10". `start`/`end` are the first occurrence. */
recurring?: PschRecurrence | string
/** Days left out of the series: "YYYY-MM-DD" strings or dates. */
recurringException?: DateInput | DateInput[]
/** Set on displayed occurrences: the `id` of the series they belong to. */
recurringEventId?: SchedulerEventId
[key: string]: unknown
}
/** A repeat rule — the object form of an RRULE. */
interface PschRecurrence {
from?: DateInput
weekStart?: number
repeat: "daily" | "weekly" | "monthly" | "yearly"
/** Every n days / weeks / months / years (default 1). */
interval?: number
/** Stop after this many occurrences (exceptions included). */
count?: number
/** Stop after this date. */
until?: DateInput
/** Weekdays: "MO,WE,FR" or [1, 3, 5] (0 = Sunday). In monthly and yearly
* rules an ordinal picks one: "2TU" (second Tuesday), "-1FR" (last Friday). */
weekDays?: string | number[]
/** Day(s) of the month; negative counts from the end (-1 = the last day). */
day?: number | number[]
/** Month(s) of a yearly rule, 1–12. */
month?: number | number[]
/** Pick the nth of the matching days in each period (-1 = the last), e.g.
* the last weekday of the month with `weekDays: "MO,TU,WE,TH,FR", pos: -1`. */
pos?: number
}
/** Something dragged in from outside: an event without a place in time yet.
* `duration` (minutes, default 60) sets its length when it has no start/end. */
interface PschExternalEvent extends SchedulerEventFields {
start?: DateInput
duration?: number
}
/** A pending event from drag/click-to-create. */
interface EventDraft {
allDay?: boolean
slot?: SlotId
start: Date
end: Date
resource?: ResourceId
title?: string
/** Set when the event was dropped in from outside (a list, another scheduler). */
external?: PschExternalEvent
}
type SlotId = string | number
const events: StudioEvent[] = [
{
"id": "s-1",
"title": "Kickoff call",
"client": "Harbor Coffee",
"kind": "Pitch",
"resource": "ben",
"start": "2026-09-28T09:00:00.000Z",
"end": "2026-09-28T10:00:00.000Z"
},
{
"id": "s-2",
"title": "Location scout",
"client": "Harbor Coffee",
"kind": "Travel",
"resource": "ada",
"start": "2026-09-28T11:00:00.000Z",
"end": "2026-09-28T14:00:00.000Z"
},
{
"id": "s-3",
"title": "Rough cut review",
"client": "Aurora Bank",
"kind": "Review",
"resource": "chloe",
"start": "2026-09-28T15:00:00.000Z",
"end": "2026-09-28T16:30:00.000Z"
},
// …17 more events
]Per-event rules
editable: false on an event renders it normally but disables move and resize for that event alone. An event without end is a point in time: it is pinned at start, can be moved but not resized, and keeps end undefined through every drag.
const events = [
{ id: 1, title: "Board meeting", start, end, editable: false }, // renders, never moves
{ id: 2, title: "Check-in", start }, // no end: a point in time
]New events
A drag-to-create opens the built-in editor pre-filled with the drafted range and resource. Saving it fires onEventCreate with the draft, then onEventCreated with an event carrying a temporary id — replace it with your server’s id when you persist. extendDefaultEvent adds your own defaults. For every timed event the editor also shows a time picker beside the fields — drag the block or its edges, with the resource's other events drawn as busy time. A multi-day range opens on its start day; all-day events keep just the date fields.
<ProScheduler
// Fields every new event starts with, from the drafted times and resource.
extendDefaultEvent={(draft) => ({ color: "#0891b2", status: "tentative" })}
…
/>