ProSchedulerSign in

Scheduler · Resources

Resource data structure

A resource is an id, a name and a colour, plus optional background, cssClass, eventCreation, children and any fields of your own.

Live demo

Try to draw an event in Chloé's column

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

const structured: SchedulerResource[] = [
  { id: "ada", name: "Ada Moreno", color: "#2563eb", role: "Director" },
  { id: "ben", name: "Ben Okafor", color: "#059669", background: "color-mix(in oklab, #059669 6%, transparent)" },
  { id: "chloe", name: "Chloé Martin", color: "#d97706", eventCreation: false, cssClass: "opacity-80" },
]

export function ResourceDataDemo() {
  const { events, handlers } = useEvents(studioSessions)

  return (
    <div className="demo-split demo-split--wide">
      <ProScheduler
        data={events}
        resources={structured}
        view={{ scheduler: { type: "day", resources: true, startTime: "07:00", endTime: "20:00" } }}
        height={560}
        {...handlers}
      />
      <aside className="demo-side">
        <p className="demo-muted">The resources passed in — Ben&apos;s column is tinted, Chloé&apos;s takes no new events.</p>
        <pre className="demo-json">{JSON.stringify(structured, null, 2)}</pre>
      </aside>
    </div>
  )
}

About this demo

A resource is an id, a name and a colour, plus optional background, cssClass, eventCreation, children and any fields of your own.

Things to try

  • Try to draw an event in Chloé's column

The props behind it are explained in Resources.

Use ProScheduler in your project