ProSchedulerSign in

Scheduler · Templating

Custom event tooltip

renderEventTooltip replaces the hover card — here with the kind, client and the person's role. Return null for no tooltip on an event.

Live demo

Hover an event

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

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

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{ scheduler: { type: "week", startTime: "07:00", endTime: "20:00" } }}
      renderEventTooltip={({ original, start, end, color }) => {
        const event = original as StudioEvent
        const person = studioResources.find((r) => r.id === event.resource)
        return (
          <div className="grid max-w-56 gap-1 py-0.5">
            <div className="flex items-center gap-1.5">
              <span className="size-2 rounded-full" style={{ background: color }} />
              <strong>{event.title}</strong>
            </div>
            <span>
              {start.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })}–
              {end.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })} · {event.kind}
            </span>
            <span className="opacity-80">
              {event.client} · {person?.name} ({person?.role})
            </span>
          </div>
        )
      }}
      height={600}
      {...handlers}
    />
  )
}

About this demo

renderEventTooltip replaces the hover card — here with the kind, client and the person's role. Return null for no tooltip on an event.

Things to try

  • Hover an event

The props behind it are explained in Custom rendering.

Use ProScheduler in your project