ProSchedulerSign in

Scheduler · Resources

Group by resource or date

Three days, three people: groupBy: "date" puts the people under each day, "resource" puts the days under each person.

Live demo

Switch the grouping · Move a session in each layout

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

export function GroupByDemo() {
  const { events, handlers } = useEvents(studioSessions)
  const [groupBy, setGroupBy] = useState<"date" | "resource">("date")

  return (
    <div className="docs-demo__stack">
      <Toolbar label="Group by">
        <Choice active={groupBy === "date"} onClick={() => setGroupBy("date")}>
          Date
        </Choice>
        <Choice active={groupBy === "resource"} onClick={() => setGroupBy("resource")}>
          Resource
        </Choice>
      </Toolbar>
      <ProScheduler
        data={events}
        resources={studioResources.slice(0, 3)}
        view={{ scheduler: { type: "day", size: 3, resources: true, groupBy, startTime: "07:00", endTime: "20:00" } }}
        height={580}
        {...handlers}
      />
    </div>
  )
}

About this demo

Three days, three people: groupBy: "date" puts the people under each day, "resource" puts the days under each person.

Things to try

  • Switch the grouping
  • Move a session in each layout

The props behind it are explained in Resources.

Use ProScheduler in your project