ProSchedulerSign in

Timeline · Use cases

Compare resources

Pick people to compare; only they get rows.

Live demo

Add Gus to the comparison · Remove everyone but one

Fullscreen
import { useState } from "react"
import { ProScheduler } from "@andreisaac/pro-scheduler"
import { studioAssignments, studioResources } from "./data/studio"
import { Choice, Toolbar, useEvents } from "./kit"

export function CompareResourcesDemo() {
  const { events, handlers } = useEvents(studioAssignments)
  const [picked, setPicked] = useState<string[]>(["ada", "chloe"])

  const toggle = (id: string) =>
    setPicked((list) => (list.includes(id) ? list.filter((x) => x !== id) : [...list, id]))

  return (
    <div className="docs-demo__stack">
      <Toolbar label="Compare">
        {studioResources.map((r) => (
          <Choice key={r.id} active={picked.includes(r.id)} onClick={() => toggle(r.id)}>
            {r.name.split(" ")[0]}
          </Choice>
        ))}
      </Toolbar>
      <ProScheduler
        data={events}
        // Only the picked people get rows — side by side for comparison.
        resources={studioResources.filter((r) => picked.includes(r.id))}
        view={{ timeline: { type: "month" } }}
        height={Math.max(260, 120 + picked.length * 64)}
        {...handlers}
      />
    </div>
  )
}

About this demo

Pick people to compare; only they get rows.

Things to try

  • Add Gus to the comparison
  • Remove everyone but one

The props behind it are explained in Resources.

Use ProScheduler in your project