ProSchedulerSign in

Timeline · Setting up

Print

print() prints every row and every day of the month, at full height.

Live demo

Press Print

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

/** A scheduler with a Print button: `print()` prints it alone, every row included. */
function Printable({ children }: { children: (ref: React.RefObject<ProSchedulerInstance | null>) => React.ReactNode }) {
  const ref = useRef<ProSchedulerInstance>(null)
  return (
    <>
      <Toolbar label="Print">
        <Choice onClick={() => ref.current?.print()}>Print</Choice>
      </Toolbar>
      {children(ref)}
    </>
  )
}

export function TimelinePrintDemo() {
  const { events, handlers } = useEvents(() => studioAssignments())
  return (
    <Printable>
      {(ref) => (
        <ProScheduler
          ref={ref}
          data={events}
          resources={studioResources}
          view={{ timeline: { type: "month" } }}
          styleConfig={{ unitWidthPx: 34, fitToWidth: true }}
          height={420}
          {...handlers}
        />
      )}
    </Printable>
  )
}

About this demo

print() prints every row and every day of the month, at full height.

Things to try

  • Press Print

The props behind it are explained in Output and scale.

Use ProScheduler in your project