ProSchedulerSign in

Scheduler · Configuring the view

Color-coded time blocks

colors shades recurring windows — focus time every weekday morning, a meeting-free Friday afternoon, evenings — without restricting anything.

Live demo

Drop an event into focus time — it's allowed · Page to next week: the blocks repeat

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

const focusBlocks: PschColor[] = [
  {
    recurring: { repeat: "weekly", weekDays: [1, 2, 3, 4, 5] },
    startTime: "09:00",
    endTime: "11:00",
    title: "Focus time",
    background: "color-mix(in oklab, #3b82f6 14%, transparent)",
    textColor: "#2563eb",
  },
  {
    recurring: { repeat: "weekly", weekDays: [5] },
    startTime: "14:00",
    endTime: "18:00",
    title: "No meetings",
    background: "color-mix(in oklab, #f59e0b 16%, transparent)",
    textColor: "#b45309",
  },
  {
    recurring: { repeat: "daily" },
    startTime: "18:00",
    endTime: "24:00",
    title: "After hours",
    background: "color-mix(in oklab, currentColor 6%, transparent)",
  },
]

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

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{ scheduler: { type: "week", startTime: "07:00", endTime: "21:00" } }}
      // Purely visual: events can still go anywhere.
      colors={focusBlocks}
      height={600}
      {...handlers}
    />
  )
}

About this demo

colors shades recurring windows — focus time every weekday morning, a meeting-free Friday afternoon, evenings — without restricting anything.

Things to try

  • Drop an event into focus time — it's allowed
  • Page to next week: the blocks repeat

The props behind it are explained in Rules and backgrounds.

Use ProScheduler in your project