ProSchedulerSign in

Scheduler · Configuring the view

All-day events

Events marked allDay, or lasting a day or more, go to the strip under the day headers. allDay: false on the view hides the strip for grids that only deal in hours.

Live demo

Hide the all-day section · Open the offsite to edit it

Fullscreen
import { useState } from "react"
import { ProScheduler } from "@andreisaac/pro-scheduler"
import { studioResources, studioSessions, weekStart } from "./data/studio"
import { Choice, Toolbar, useEvents } from "./kit"

export function AllDayDemo() {
  const { events, handlers } = useEvents(() => {
    const monday = weekStart()
    const day = (n: number) => new Date(monday.getFullYear(), monday.getMonth(), monday.getDate() + n)
    return [
      ...studioSessions(),
      { id: "off-1", title: "Team offsite", start: day(2), end: day(4), allDay: true, color: "#0f766e" },
      { id: "off-2", title: "Studio closed", start: day(5), end: day(7), allDay: true, color: "#64748b" },
      { id: "off-3", title: "Ada on leave", start: day(0), end: day(1), allDay: true, resource: "ada" },
    ]
  })
  const [showAllDay, setShowAllDay] = useState(true)

  return (
    <div className="docs-demo__stack">
      <Toolbar>
        <Choice active={showAllDay} onClick={() => setShowAllDay(!showAllDay)}>
          All-day section
        </Choice>
      </Toolbar>
      <ProScheduler
        data={events}
        resources={studioResources}
        view={{ scheduler: { type: "week", startTime: "07:00", endTime: "20:00", allDay: showAllDay } }}
        height={600}
        {...handlers}
      />
    </div>
  )
}

About this demo

Events marked allDay, or lasting a day or more, go to the strip under the day headers. allDay: false on the view hides the strip for grids that only deal in hours.

Things to try

  • Hide the all-day section
  • Open the offsite to edit it

The props behind it are explained in Views.

Use ProScheduler in your project