ProSchedulerSign in

Agenda · Templating

Full event customization

renderAgendaEvent replaces the whole row — here, cards with an avatar and the duration.

Live demo

Compare with the default rows

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

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

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{ agenda: { type: "week" } }}
      // The whole row is yours: here, a card with an avatar and a duration.
      renderAgendaEvent={({ original, start, end }) => {
        const event = original as StudioEvent
        const person = studioResources.find((r) => r.id === event.resource)
        const minutes = Math.round((end.getTime() - start.getTime()) / 60_000)
        return (
          <div className="m-2 flex w-full items-center gap-3 rounded-lg border border-border bg-card p-3 text-left shadow-xs">
            <span
              className="flex size-9 shrink-0 items-center justify-center rounded-full text-xs font-semibold text-white"
              style={{ background: person?.color }}
            >
              {person?.name
                .split(" ")
                .map((part) => part[0])
                .join("")}
            </span>
            <div className="min-w-0 flex-1">
              <div className="truncate text-sm font-semibold">{event.title}</div>
              <div className="truncate text-xs text-muted-foreground">
                {start.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" })} · {minutes} min · {event.client}
              </div>
            </div>
          </div>
        )
      }}
      height={560}
      {...handlers}
    />
  )
}

About this demo

renderAgendaEvent replaces the whole row — here, cards with an avatar and the duration.

Things to try

  • Compare with the default rows

The props behind it are explained in Custom rendering.

Use ProScheduler in your project