ProSchedulerSign in

Timeline · Look & feel

Cell hover highlight

onCellHoverIn turns the hovered day into a colour range across every row.

Live demo

Move the pointer across the month

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

const day = (base: Date, n: number) => new Date(base.getFullYear(), base.getMonth(), base.getDate() + n)

export function HoverHighlightDemo() {
  const { events, handlers } = useEvents(studioAssignments)
  const [hovered, setHovered] = useState<Date | null>(null)

  // The hovered day becomes a colour range across every row.
  const colors: PschColor[] = hovered
    ? [{ start: hovered, end: day(hovered, 1), background: "color-mix(in oklab, var(--primary) 12%, transparent)" }]
    : []

  return (
    <ProScheduler
      data={events}
      resources={studioResources}
      view={{ timeline: { type: "month" } }}
      colors={colors}
      onCellHoverIn={({ date }) => setHovered(date)}
      onCellHoverOut={() => setHovered(null)}
      height={520}
      {...handlers}
    />
  )
}

About this demo

onCellHoverIn turns the hovered day into a colour range across every row.

Things to try

  • Move the pointer across the month

The props behind it are explained in Rules and backgrounds.

Use ProScheduler in your project