ProSchedulerSign in

Scheduler · Configuring the view

Visible hours and days

Change the first and last hour, and hide or show weekends. Everything else about the scheduler stays as it was.

Live demo

Start the day at 06:00 · Turn weekends on

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

export function VisibleHoursDemo() {
  const { events, handlers } = useEvents(studioSessions)
  const [start, setStart] = useState("07:00")
  const [end, setEnd] = useState("20:00")
  const [weekends, setWeekends] = useState(false)

  return (
    <div className="docs-demo__stack">
      <Toolbar label="Visible range">
        <Field label="From">
          <select value={start} onChange={(e) => setStart(e.target.value)}>
            {["00:00", "06:00", "07:00", "08:00", "09:00"].map((t) => (
              <option key={t}>{t}</option>
            ))}
          </select>
        </Field>
        <Field label="To">
          <select value={end} onChange={(e) => setEnd(e.target.value)}>
            {["17:00", "18:00", "20:00", "22:00", "24:00"].map((t) => (
              <option key={t}>{t}</option>
            ))}
          </select>
        </Field>
        <Choice active={weekends} onClick={() => setWeekends(!weekends)}>
          Weekends
        </Choice>
      </Toolbar>
      <ProScheduler
        data={events}
        resources={studioResources}
        view={{
          scheduler: {
            type: "week",
            startTime: start,
            endTime: end,
            startDay: weekends ? 0 : 1,
            endDay: weekends ? 6 : 5,
          },
        }}
        height={560}
        {...handlers}
      />
    </div>
  )
}

About this demo

Change the first and last hour, and hide or show weekends. Everything else about the scheduler stays as it was.

Things to try

  • Start the day at 06:00
  • Turn weekends on

The props behind it are explained in Views.

Use ProScheduler in your project