ProSchedulerSign in

Agenda · Setting up

Print

print() prints the whole list, every day of the week, not only what's scrolled into view.

Live demo

Press Print

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 AgendaPrintDemo() {
  const { events, handlers } = useEvents(() => studioSessions())
  return (
    <Printable>
      {(ref) => (
        <ProScheduler
          ref={ref}
          data={events}
          resources={studioResources}
          view={{ agenda: { type: "week" } }}
          height={480}
          {...handlers}
        />
      )}
    </Printable>
  )
}

About this demo

print() prints the whole list, every day of the week, not only what's scrolled into view.

Things to try

  • Press Print

The props behind it are explained in Output and scale.

Use ProScheduler in your project