ProSchedulerSign in

Scheduler · Templating

Custom header

renderHeader rebuilds the toolbar from the same building blocks the default uses, plus anything of your own.

Live demo

Use the rearranged arrows · Switch to the agenda

Fullscreen
import { CalendarNav, CalendarNext, CalendarPrev, CalendarToday, ProScheduler, ViewLengthSelect, ViewSwitcher } from "@andreisaac/pro-scheduler"
import { studioResources, studioSessions } from "./data/studio"
import { useEvents } from "./kit"

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

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{
        scheduler: { type: "week", startTime: "07:00", endTime: "20:00" },
        agenda: { type: "week" },
      }}
      renderHeader={() => (
        <div className="flex flex-wrap items-center gap-2 border-b border-border px-3 py-2">
          <CalendarNav className="mr-auto" />
          <span className="text-xs text-muted-foreground">{events.length} bookings</span>
          <ViewLengthSelect />
          <ViewSwitcher />
          <div className="flex gap-1">
            <CalendarPrev />
            <CalendarToday>Now</CalendarToday>
            <CalendarNext />
          </div>
        </div>
      )}
      height={600}
      {...handlers}
    />
  )
}

About this demo

renderHeader rebuilds the toolbar from the same building blocks the default uses, plus anything of your own.

Things to try

  • Use the rearranged arrows
  • Switch to the agenda

The props behind it are explained in Custom rendering.

Use ProScheduler in your project