ReactToPrint

Print React components in the browser

README

react-to-print logo


ReactToPrint - Print React components in the browser

NPM Downloads npm version

So you've created a React component and would love to give end users the ability to print out the contents of that component. This package aims to solve that by popping up a print window with CSS styles copied over as well.

Demo

Run react-to-print

Install


npm install --save react-to-print

API


<ReactToPrint />


The component accepts the following props:

| Name | Type | Description |
| :-------------------: | :------- | :---------------------------------------------------------------------------------------------------------------------------------- |
| bodyClass? | string | One or more class names to pass to the print window, separated by spaces |
| content | function | A function that returns a component reference value. The content of this reference value is then used for print |
| **`copyStyles?`** | `boolean` | Copy all `