ProSchedulerSign in

Features

Resources

People, rooms, vehicles or machines: rows in the timeline, columns in the time grid, groups that collapse, and events shared between several of them.

Declaring resources

Pass resources and point each event at one — or several — with resource. An event’s own color wins over its resource’s.

type SchedulerResource = {
  id: string | number
  name: string
  color?: string              // used by events that have no colour of their own
  children?: SchedulerResource[] // makes this a collapsible group (timeline)
  collapsed?: boolean         // start the group collapsed
  eventCreation?: boolean     // false: no new or moved-in events on this row/column
  background?: string         // row (timeline) or column (time grid) background
  cssClass?: string
  [key: string]: unknown      // role, avatar, capacity… anything you render
}

Rows in the timeline

The timeline draws a row per resource in the order given. A vertical drag reassigns the event; dragBetweenResources={false} turns that off everywhere, and resourceEditable: false on an event or eventCreation: false on a resource turns it off case by case.

Live demo

A crew for the week

Each row shows the person's role. Drag a session up or down to hand it to someone else.

import { useMemo, useState, useSyncExternalStore } from "react"
import { ProScheduler, type SchedulerEvent } from "@/components/pro-scheduler"
import { studioResources, studioSessions } 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 ResourcesDemo() {
  const hydrated = useHydrated()
  const { events, handlers } = useEvents(studioSessions)
  if (!hydrated) return <Placeholder height={520} />

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{ timeline: { type: "week", resolutionHorizontal: "day", dragTimeStep: 60 } }}
      dragBetweenResources
      renderResource={(resource) => (
        <div className="flex min-w-0 items-center gap-2">
          <span
            className="size-2.5 shrink-0 rounded-full"
            style={{ background: String(resource.color) }}
          />
          <div className="min-w-0">
            <div className="truncate text-sm font-medium">{resource.name}</div>
            <div className="truncate text-xs text-muted-foreground">{String(resource.role)}</div>
          </div>
        </div>
      )}
      height={520}
      {...handlers}
    />
  )
}

Columns in the time grid

resources: true on the time grid splits each day into a column per resource (only the leaves of a tree), with a second header row. Each column shows its resource’s events; drawing in a column books that resource, and dragging across columns reassigns.

<ProScheduler
  data={appointments}
  resources={doctors}
  view={{
    scheduler: {
      type: "day",
      resources: true,      // a column per resource
      groupBy: "date",      // or "resource": the days under each resource
    },
  }}
/>

Shared events

An array of resource ids makes one event belong to all of them. It renders once per resource, counts against each of them when overlaps are refused, and a drag moves only the copy you picked up.

// One meeting, three people: it shows in each of their rows or columns.
{ id: 7, title: "Kickoff", start, end, resource: ["ada", "ben", "chloe"] }

// Dragging Ben's copy onto Dev swaps just that one:
// resource: ["ada", "dev", "chloe"]

Groups and hierarchy

Resources with children become collapsible groups in the timeline, nested as deep as you like. groupSummary shows each group’s descendants’ events on its own row, faded and read-only, so a collapsed group still shows how busy it is. The built-in editor lists only the leaves.

const resources = [
  {
    id: "post",
    name: "Post-production",
    eventCreation: false,            // department rows are headings
    children: [
      { id: "chloe", name: "Chloé Martin" },
      { id: "dev", name: "Dev Patel" },
    ],
  },
  { id: "camera", name: "Camera", collapsed: true, children: [/* … */] },
]

<ProScheduler
  resources={resources}
  view={{ timeline: { type: "month", groupSummary: true } }}
  onResourceCollapse={(group, collapsed) => save(group.id, collapsed)}
/>

Row options, sidebars and footers

<ProScheduler
  view={{ timeline: { type: "month", maxEventStack: 2, rowHeight: "equal" } }}
  renderResourceHeader={() => "Crew"}
  renderResource={(r) => <Person person={r} />}
  renderSidebarHeader={() => "Revenue"}
  renderSidebar={(r) => <Revenue of={r} />}      // a right-hand column
  renderDayFooter={({ date, events }) => events.length}  // a cell under each day
  renderResourceFooter={() => "Total"}           // the bottom-left corner
  styleConfig={{ resourceColWidth: 220, sidebarWidth: 140, footerHeight: 36 }}
/>
Timeline row options
OptionEffect
maxEventStackStacked events per row before a "+N more" chip per column
rowHeight: "equal"Every row as tall as the tallest
groupSummaryGroup rows show their descendants' events, faded