ProSchedulerSign in

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

What each gesture does
GestureTimelineTime grid
Drag an eventEarlier / later, and to another resource rowAnother time or day; past midnight into the next day
Drag an edgeLeft or right edgeTop or bottom edge
Drag on empty spaceCreates across the dragged rangeCreates down the dragged range
Click an eventOpens the editorOpens the editor
Swipe the panel (panelDragNavigate)Previous / next periodPrevious / 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)))}
/>
Live demo

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>
  )
}

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" })}
  …
/>