Features
Custom rendering
Replace what is inside an event, the whole event, the day headers, the resource cells or the header bar — keeping the drag, resize and layout behaviour underneath.
Event content
renderEventContent replaces the inside of every event and keeps the default chrome — colour, rounded block, resize handles, drag. It receives the event data: your event as original, normalized start and end dates, the resolved color, and isMultiDay.
<ProScheduler
renderEventContent={({ original, start, end, color, isMultiDay }) => (
<div className="grid gap-0.5 text-xs">
<strong>{original.title}</strong>
<span>{original.client}</span>
</div>
)}
…
/>| Prop | Replaces | Scope |
|---|---|---|
renderEventContent | The inside of the event | Every view |
renderEvent | The whole event element | Every view |
renderTimelineEvent | The whole event element | Timeline only; wins over renderEvent |
renderSchedulerEvent | The whole event element | Time grid only |
renderAgendaEvent | The whole list item | Agenda only |
Coloured by kind, with the client inside
Events carry the client and time; the header is rebuilt from the building blocks.
import { useMemo, useState, useSyncExternalStore } from "react"
import { CalendarNav, CalendarNext, CalendarPrev, CalendarToday, ProScheduler, type SchedulerEvent } from "@/components/pro-scheduler"
import { kindColors, studioResources, studioSessions, type StudioEvent } from "@/lib/demo-data/studio"
const subscribe = () => () => {}
/** False during the server render and hydration, true afterwards. */
function useHydrated() {
return useSyncExternalStore(subscribe, () => true, () => false)
}
function Placeholder({ height }: { height: number }) {
return <div aria-hidden className="docs-demo__placeholder" style={{ height }} />
}
/**
* ProScheduler is controlled: it never edits `data` itself. The callbacks below
* are the whole contract — apply the change, and the view re-renders from it.
*/
function useEvents(initial: () => SchedulerEvent[]) {
const [events, setEvents] = useState(initial)
const handlers = useMemo(
() => ({
onEventCreated: (event: SchedulerEvent) =>
setEvents((list) => [...list, { ...event, id: crypto.randomUUID() }]),
onEventUpdated: (event: SchedulerEvent) =>
setEvents((list) => list.map((e) => (e.id === event.id ? event : e))),
onEventDeleted: (event: SchedulerEvent) =>
setEvents((list) => list.filter((e) => e.id !== event.id)),
}),
[]
)
return { events, setEvents, handlers }
}
export function CustomRenderingDemo() {
const hydrated = useHydrated()
const { events, handlers } = useEvents(() =>
// Colour by kind of work rather than by person.
studioSessions().map((event) => ({ ...event, color: kindColors[event.kind] }))
)
if (!hydrated) return <Placeholder height={600} />
return (
<ProScheduler
data={events}
resources={studioResources}
view={{ scheduler: { type: "week", startTime: "07:00", endTime: "19:00" } }}
height={600}
renderHeader={() => (
<div className="flex items-center justify-between gap-2 border-b border-border px-3 py-2">
<div className="flex items-center gap-1">
<CalendarPrev />
<CalendarToday />
<CalendarNext />
</div>
<CalendarNav />
<span className="text-xs text-muted-foreground">{events.length} bookings</span>
</div>
)}
renderEventContent={({ original, start }) => {
const event = original as StudioEvent
return (
<div className="grid gap-0.5 text-xs leading-tight">
<strong className="truncate">{event.title}</strong>
<span className="truncate opacity-85">{event.client}</span>
<span className="opacity-70">
{start.toLocaleTimeString(undefined, { hour: "2-digit", minute: "2-digit" })} · {event.kind}
</span>
</div>
)
}}
{...handlers}
/>
)
}// `renderEventContent` receives this shape; `original` is your event.
type SchedulerEventId = string | number
type ResourceId = string | number
/** Accepts Date | ISO string | epoch ms; normalized to Date via {@link toDate}. */
type DateInput = Date | string | number
/** A row/grouping target. Extra keys are preserved (passthrough). */
interface SchedulerResource {
eventDragBetweenResources?: boolean
eventDragBetweenSlots?: boolean
eventDragInTime?: boolean
eventOverlap?: boolean
eventResize?: boolean
fixed?: boolean
reorder?: boolean
id: ResourceId
name: string
/** Accent color (hex/css), used for events lacking their own `color`. */
color?: string
/** Child resources: this one becomes a collapsible group (timeline). */
children?: SchedulerResource[]
/** Start this group collapsed. */
collapsed?: boolean
/** Set false to stop events being created on, or moved onto, this row. */
eventCreation?: boolean
/** Background of this resource's row (timeline) or columns (time grid). */
background?: string
/** Extra classes on this resource's row or columns. */
cssClass?: string
[key: string]: unknown
}
/** Everything an event has but its start (shared with dragged-in events). */
interface SchedulerEventFields {
cssClass?: string
cellCssClass?: string
textColor?: string
tooltip?: string
order?: number
timezone?: string
slot?: SlotId
dragBetweenResources?: boolean
dragBetweenSlots?: boolean
recurringExceptionRule?: PschRecurrence | string
id?: SchedulerEventId
title: string
/** Omit for point-in-time events: they are pinned at `start`, never resizable,
* and (in the scheduler view's auto mode) overlap-packed by rendered height. */
end?: DateInput
/** The resource it's booked on — or several, for a shared event (a meeting
* with three people shows in each of their rows or columns). */
resource?: ResourceId | ResourceId[]
color?: string
allDay?: boolean
/** Set false to lock this event: it renders but can't be moved or resized. */
editable?: boolean
/** Set false to keep the duration fixed: the event moves but can't be resized. */
resize?: boolean
/** Set false so moving can't change the time — only the resource (timeline).
* In the time grid, where a move always changes the time, the event is fixed. */
dragInTime?: boolean
/** Set false so moving can't change the resource — only the time. */
resourceEditable?: boolean
/** Minutes kept free before / after the event (travel, set-up, cleaning).
* Drawn as a hatched band, and counted when `eventOverlap` is false. */
bufferBefore?: number
bufferAfter?: number
/** Set false to refuse any overlap with this event, whatever `eventOverlap` says. */
overlap?: boolean
/** Repeat the event: a rule object, or an RRULE string such as
* "FREQ=WEEKLY;BYDAY=MO,WE;COUNT=10". `start`/`end` are the first occurrence. */
recurring?: PschRecurrence | string
/** Days left out of the series: "YYYY-MM-DD" strings or dates. */
recurringException?: DateInput | DateInput[]
/** Set on displayed occurrences: the `id` of the series they belong to. */
recurringEventId?: SchedulerEventId
[key: string]: unknown
}
interface SchedulerEvent extends SchedulerEventFields {
start: DateInput
}
/** A repeat rule — the object form of an RRULE. */
interface PschRecurrence {
from?: DateInput
weekStart?: number
repeat: "daily" | "weekly" | "monthly" | "yearly"
/** Every n days / weeks / months / years (default 1). */
interval?: number
/** Stop after this many occurrences (exceptions included). */
count?: number
/** Stop after this date. */
until?: DateInput
/** Weekdays: "MO,WE,FR" or [1, 3, 5] (0 = Sunday). In monthly and yearly
* rules an ordinal picks one: "2TU" (second Tuesday), "-1FR" (last Friday). */
weekDays?: string | number[]
/** Day(s) of the month; negative counts from the end (-1 = the last day). */
day?: number | number[]
/** Month(s) of a yearly rule, 1–12. */
month?: number | number[]
/** Pick the nth of the matching days in each period (-1 = the last), e.g.
* the last weekday of the month with `weekDays: "MO,TU,WE,TH,FR", pos: -1`. */
pos?: number
}
type SchedulerViewType = "timeline" | "scheduler" | "agenda" | "calendar"
interface PschCalendarEventData {
view?: SchedulerViewType
formattedStart?: string
formattedEnd?: string
currentResource?: SchedulerResource
slot?: PschSlot
segmentStart?: Date
segmentEnd?: Date
lastDay?: Date
isSelected?: boolean
isActive?: boolean
original: SchedulerEvent
title: string
start: Date
end: Date
resource?: ResourceId | ResourceId[]
color?: string
isMultiDay: boolean
}
type SlotId = string | number
interface PschSlot {
id: SlotId
name: string
eventDragBetweenSlots?: boolean
eventCreation?: boolean
eventOverlap?: boolean
cssClass?: string
color?: string
}
const events: StudioEvent[] = [
{
"id": "s-1",
"title": "Kickoff call",
"client": "Harbor Coffee",
"kind": "Pitch",
"resource": "ben",
"start": "2026-09-28T09:00:00.000Z",
"end": "2026-09-28T10:00:00.000Z"
},
{
"id": "s-2",
"title": "Location scout",
"client": "Harbor Coffee",
"kind": "Travel",
"resource": "ada",
"start": "2026-09-28T11:00:00.000Z",
"end": "2026-09-28T14:00:00.000Z"
},
// …18 more events
]Your own header
renderHeader replaces the whole navigation bar. Compose it from the same blocks the default uses — they read the scheduler’s state from context, so they need no props — or read useScheduler() for the title, the active view and the navigation functions and build something entirely your own.
import {
CalendarNav, CalendarPrev, CalendarNext, CalendarToday,
ViewSwitcher, ViewLengthSelect, useScheduler,
} from "@andreisaac/pro-scheduler"
function Toolbar() {
const { title, activeType } = useScheduler()
return (
<div className="flex items-center justify-between border-b px-3 py-2">
<div className="flex gap-1">
<CalendarPrev /><CalendarToday /><CalendarNext />
</div>
<CalendarNav />
<div className="flex gap-2">
<ViewLengthSelect />
<ViewSwitcher />
</div>
</div>
)
}
<ProScheduler renderHeader={() => <Toolbar />} … />Day and column headers
renderDay replaces each day heading in the time grid and the timeline, and the content of each day cell in the calendar. renderHour, renderWeek, renderMonth and renderYear are accepted as aliases.
<ProScheduler
renderDay={({ date }) => (
<div className="text-center">
<div className="text-xs uppercase">{date.toLocaleDateString(undefined, { weekday: "short" })}</div>
<div className="font-semibold">{date.getDate()}</div>
</div>
)}
…
/>