ProSchedulerSign in

Timeline · Templating

Row and column sizing

Lane height, day width and fitting to the width, live through styleConfig.

Live demo

Make lanes taller · Narrow the days and scroll

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

export function RowSizingDemo() {
  const { events, handlers } = useEvents(studioAssignments)
  const [laneHeight, setLaneHeight] = useState(32)
  const [unitWidth, setUnitWidth] = useState(48)
  const [fit, setFit] = useState(false)

  return (
    <div className="docs-demo__stack">
      <Toolbar label="Sizes">
        <Field label={`Lane ${laneHeight}px`}>
          <input type="range" min={20} max={60} value={laneHeight} onChange={(e) => setLaneHeight(Number(e.target.value))} />
        </Field>
        <Field label={`Day ${unitWidth}px`}>
          <input type="range" min={24} max={120} value={unitWidth} onChange={(e) => setUnitWidth(Number(e.target.value))} />
        </Field>
        <Choice active={fit} onClick={() => setFit(!fit)}>
          Fit to width
        </Choice>
      </Toolbar>
      <ProScheduler
        data={events}
        resources={studioResources}
        view={{ timeline: { type: "month" } }}
        styleConfig={{
          laneHeight,
          laneGap: 4,
          rowPadding: 6,
          minRowHeight: laneHeight + 12,
          unitWidthPx: unitWidth,
          fitToWidth: fit,
        }}
        height={520}
        {...handlers}
      />
    </div>
  )
}

About this demo

Lane height, day width and fitting to the width, live through styleConfig.

Things to try

  • Make lanes taller
  • Narrow the days and scroll

The props behind it are explained in Sizing & theming.

Use ProScheduler in your project