npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mmmmzxe/react-print

v1.0.0

Published

Unified React print engine — render components in a sandboxed iframe with Tailwind/CSS sync and native print.

Readme

@mmmmzxe/react-print

npm version license: MIT

Unified React print engine. Renders a declarative React component tree inside a hidden iframe, synchronizes active styles (Tailwind CSS, CSS modules, styled-components), and triggers the native print dialog.

Install

npm install @mmmmzxe/react-print

Peer dependencies: react and react-dom (18+).

Quick start

Imperative print (recommended)

Pass print options directly when calling print — no provider or context required:

import { usePrinter } from '@mmmmzxe/react-print';

const { print } = usePrinter();

await print({
  title: 'Commercial Offer',
  component: <MyDocument {...props} />,
  paper: 'A4',
  orientation: 'portrait',
  margin: 14,
});

Declarative print

import { Print } from '@mmmmzxe/react-print';

<Print
  options={{ paper: 'A4', margin: 10, orientation: 'portrait', title: 'Invoice #123' }}
  component={<Invoice data={invoice} />}
>
  {({ onPrint }) => (
    <button type="button" onClick={onPrint}>
      Print
    </button>
  )}
</Print>

Ref-based print

Print existing DOM via a ref:

import { useReactToPrint } from '@mmmmzxe/react-print';

const contentRef = useRef<HTMLDivElement>(null);
const { handlePrint } = useReactToPrint({
  contentRef,
  paper: 'A4',
  orientation: 'portrait',
});

<div ref={contentRef}>...</div>
<button type="button" onClick={() => void handlePrint()}>Print</button>

Tailwind CSS

The engine clones <link rel="stylesheet"> and <style> tags from the host page into the print iframe and syncs :root theme tokens.

Tailwind v4: scan package utility classes in your app CSS:

@import 'tailwindcss';
@source "../node_modules/@mmmmzxe/react-print/dist/**/*.js";

If you use PrintSheet / PrintSection helpers, include their classes in your Tailwind content/source paths.

Next.js

Add the package to transpilePackages (usually not required when consuming built dist, but safe for linked workspaces):

// next.config.ts
const nextConfig = {
  transpilePackages: ['@mmmmzxe/react-print'],
};

Layout helpers

import { PrintSheet, PrintSection } from '@mmmmzxe/react-print';

<PrintSheet>
  <PrintSection className="p-4">...</PrintSection>
</PrintSheet>

API

| Export | Description | |--------|-------------| | Print | Declarative wrapper with options + render-prop trigger | | usePrinter | Imperative print({ component, ...options }) | | useReactToPrint | Print existing DOM via ref | | printReactTree | Low-level engine entry | | PrintSheet / PrintSection | Tailwind layout primitives |

Development

git clone https://github.com/maryemmostafa24/react-print.git
cd react-print
npm install
npm run build
npm run typecheck

Links

License

MIT — see LICENSE.