ProSchedulerSign in

Timeline · Configuring the view

Time cell step

timeCellStep sets the minutes per column at hour resolution: 15, 30, 60, 120…

Live demo

Switch to 15 minutes · Resize a shift

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

const steps = [15, 30, 60, 120]

export function TimeCellStepDemo() {
  const { events, handlers } = useEvents(() => crewShifts())
  const [step, setStep] = useState(30)
  return (
    <>
      <Toolbar label="Column length">
        {steps.map((n) => (
          <Choice key={n} active={step === n} onClick={() => setStep(n)}>
            {n < 60 ? `${n} min` : `${n / 60} h`}
          </Choice>
        ))}
      </Toolbar>
      <ProScheduler
        data={events}
        resources={crew}
        view={{ timeline: { type: "day", timeCellStep: step, unitWidthPx: step < 60 ? 48 : 64 } }}
        dragTimeStep={Math.min(step, 30)}
        styleConfig={{ fitToWidth: false }}
        height={520}
        {...handlers}
      />
    </>
  )
}

About this demo

timeCellStep sets the minutes per column at hour resolution: 15, 30, 60, 120…

Things to try

  • Switch to 15 minutes
  • Resize a shift

The props behind it are explained in Scales, ranges and zoom.

Use ProScheduler in your project