ProSchedulerSign in

Scheduler · Setting up

Print

print() on the instance prints the scheduler alone — the rest of the page is left out, and every hour of the grid is included, not just what's scrolled into view.

Live demo

Press Print, then look at the preview

Fullscreen
import { useRef } from "react"
import { ProScheduler, type ProSchedulerInstance } from "@andreisaac/pro-scheduler"
import { studioResources, studioSessions } 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 SchedulerPrintDemo() {
  const { events, handlers } = useEvents(() => studioSessions())
  return (
    <Printable>
      {(ref) => (
        <ProScheduler
          ref={ref}
          data={events}
          resources={studioResources}
          view={{ scheduler: { type: "week", startTime: "08:00", endTime: "19:00" } }}
          height={560}
          {...handlers}
        />
      )}
    </Printable>
  )
}

About this demo

print() on the instance prints the scheduler alone — the rest of the page is left out, and every hour of the grid is included, not just what's scrolled into view.

Things to try

  • Press Print, then look at the preview

The props behind it are explained in Output and scale.

Use ProScheduler in your project