# react-print-component

> Print your component!

Latest version **0.1.8** (published 2018-02-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-print-component
pnpm add react-print-component
yarn add react-print-component
bun add react-print-component
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2018-02-01 |
| First published | 2018-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Deliay |
| Maintainers | deliay |

## Links

- npm: https://www.npmjs.com/package/react-print-component
- npm.io page: https://npm.io/package/react-print-component

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.2.0

## Recent versions

- 0.1.8 (latest) — 2018-02-01
- 0.1.7 — 2018-02-01
- 0.1.6 — 2018-01-30
- 0.1.5 — 2018-01-26
- 0.1.4 — 2018-01-26
- 0.1.3 — 2018-01-26
- 0.1.2 — 2018-01-26
- 0.1.1 — 2018-01-26
- 0.1.0 — 2018-01-25

## README

# React Print Component
    Print your component!

## Arguments

| Name | Type | Default | Description |
| :- | :- | :- | :- |
| singlePage | boolean | | Add a `react-print-single` class to print `<div>`

## Example Usage

1. Add `<PrintComponent />` Element to your root element

    ```jsx

    ...

    render() {
        return (
            <div>
                <PrintComponent />
                <div className="main-root"></div>
            </div>
        );
    }

    ...

    ```

2. Use static functions to print your components.
    ```js
    import PrintComponent from 'react-print-component';

    export class TestComponent() {

        ...

        onPrintButtonClick() {
            //Replace components added
            PrintComponent.SetPrintContent(this.render());
            //Add components to list
            PrintComponent.AddPrintContent(this.render());
            PrintComponent.AddPrintContent(<div>{"Mulit element"}</div>);
            //Clear all added components in list
            PrintComponent.ClearComponent();
            ...
            do something
            ...

            //Call this method to print
            PrintComponent.Print();
        }

        ...
    }
    ```

3. Write print style in `@media`
    ```css
        @media print {
            
            ...
            
            h1 {}
            h2 {}
            button {}
            input[type=text] {}

            ...
        }
    ```

---
_Source: https://npm.io/package/react-print-component · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
