ProSchedulerSign in

Scheduler · Templating

Custom resource headers

With resource columns, renderResource fills each column heading: an avatar, the name and the role.

Live demo

Move a session between people

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

export function ResourceHeaderDemo() {
  const { events, handlers } = useEvents(studioSessions)
  const people = studioResources.slice(0, 4)

  return (
    <ProScheduler
      data={events}
      resources={people}
      view={{ scheduler: { type: "day", size: 2, resources: true, startTime: "07:00", endTime: "20:00" } }}
      styleConfig={{ headerHeight: 64 }}
      renderResource={(person) => (
        <div className="flex min-w-0 items-center gap-2">
          <span
            className="flex size-8 shrink-0 items-center justify-center rounded-full text-[11px] font-semibold text-white"
            style={{ background: String(person.color) }}
          >
            {person.name
              .split(" ")
              .map((part) => part[0])
              .join("")}
          </span>
          <div className="min-w-0 text-left leading-tight">
            <div className="truncate text-xs font-semibold">{person.name}</div>
            <div className="truncate text-[10px] text-muted-foreground">{String(person.role)}</div>
          </div>
        </div>
      )}
      height={600}
      {...handlers}
    />
  )
}

About this demo

With resource columns, renderResource fills each column heading: an avatar, the name and the role.

Things to try

  • Move a session between people

The props behind it are explained in Custom rendering.

Use ProScheduler in your project