react-to-print

  • Version 3.2.0
  • Published
  • 41.4 kB
  • No dependencies
  • MIT license

Install

npm i react-to-print
yarn add react-to-print
pnpm add react-to-print

Overview

Print React components in the browser

Index

Functions

function useReactToPrint

useReactToPrint: ({
bodyClass,
contentRef,
copyShadowRoots,
documentTitle,
fonts,
ignoreGlobalStyles,
nonce,
onAfterPrint,
onBeforePrint,
onPrintError,
pageStyle,
preserveAfterPrint,
print,
printIframeProps,
suppressErrors,
}: UseReactToPrintOptions) => UseReactToPrintFn;

    Interfaces

    interface UseReactToPrintOptions

    interface UseReactToPrintOptions {}

      property bodyClass

      bodyClass?: string;

        property contentRef

        contentRef?: RefObject<ContentNode>;

          property copyShadowRoots

          copyShadowRoots?: boolean;

            property documentTitle

            documentTitle?: string;

              property fonts

              fonts?: Font[];

                property ignoreGlobalStyles

                ignoreGlobalStyles?: boolean;

                  property nonce

                  nonce?: string;

                    property onAfterPrint

                    onAfterPrint?: () => void;

                      property onBeforePrint

                      onBeforePrint?: () => Promise<void>;

                        property onPrintError

                        onPrintError?: (errorLocation: 'onBeforePrint' | 'print', error: Error) => void;

                          property pageStyle

                          pageStyle?: string;

                            property preserveAfterPrint

                            preserveAfterPrint?: boolean;

                              property print

                              print?: (target: HTMLIFrameElement) => Promise<any>;

                                property printIframeProps

                                printIframeProps?: {
                                allow?: IframeHTMLAttributes<HTMLIFrameElement>['allow'];
                                referrerPolicy?: IframeHTMLAttributes<HTMLIFrameElement>['referrerPolicy'];
                                sandbox?: IframeHTMLAttributes<HTMLIFrameElement>['sandbox'];
                                };

                                  property suppressErrors

                                  suppressErrors?: boolean;

                                    Type Aliases

                                    type UseReactToPrintFn

                                    type UseReactToPrintFn = (content?: UseReactToPrintHookContent) => void;

                                      Package Files (4)

                                      Dependencies (0)

                                      No dependencies.

                                      Dev Dependencies (23)

                                      Peer Dependencies (1)

                                      Badge

                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/react-to-print.

                                      • Markdown
                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/react-to-print)
                                      • HTML
                                        <a href="https://www.jsdocs.io/package/react-to-print"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>