ProSchedulerSign in

Scheduler · Configuring the view

Limit overlapping events

maxEventStack caps how many overlapping events sit side by side; the rest go behind a "+N more" chip that lists them.

Live demo

Show one at a time · Open a +N chip and pick someone

Fullscreen
import { useState } from "react"
import { ProScheduler } from "@andreisaac/pro-scheduler"
import { crew, crewShifts } from "./data/shifts"
import { Choice, Toolbar, useEvents } from "./kit"

export function LimitOverlapDemo() {
  const { events, handlers } = useEvents(() =>
    crewShifts().map((shift) => ({
      ...shift,
      title: String(crew.find((person) => person.id === shift.resource)?.name ?? ""),
    }))
  )
  const [max, setMax] = useState(2)

  return (
    <div className="docs-demo__stack">
      <Toolbar label="Side by side">
        {[1, 2, 3].map((n) => (
          <Choice key={n} active={max === n} onClick={() => setMax(n)}>
            Show {n}
          </Choice>
        ))}
        <Choice active={max === 99} onClick={() => setMax(99)}>
          All
        </Choice>
      </Toolbar>
      <ProScheduler
        data={events}
        resources={crew}
        view={{ scheduler: { type: "week", startTime: "06:00", endTime: "30:00", maxEventStack: max } }}
        styleConfig={{ hourHeightPx: 32 }}
        height={600}
        {...handlers}
      />
    </div>
  )
}

About this demo

maxEventStack caps how many overlapping events sit side by side; the rest go behind a "+N more" chip that lists them.

Things to try

  • Show one at a time
  • Open a +N chip and pick someone

The props behind it are explained in Views.

Use ProScheduler in your project