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

enoviq-react-document-viewer

v1.0.10

Published

Custom React & Next.js compatible document viewer package

Readme

Enoviq React Document Viewer

Enoviq React Document Viewer is a package that allows you to easily add document viewer functionality to your React applications.

Installation

You can install Enoviq React Document Viewer using npm:

 npm install enoviq-react-document-viewer

or

 yarn add enoviq-react-document-viewer

How to use in your code.

import ENDocumentPreview from "enoviq-react-document-viewer";

then you can call this in component like this.

 <ENDocumentPreview file={"/Images/logo.jpg"} />

Props Configuration

| Prop | Type | Required | Description | | -------------- | ----------- | -------- | --------------------------------------- | | file | string | ✅ | Path to the document file | | openFile | boolean | ❌ | Controls popup visibility | | onClose | function | ❌ | Callback function to close the popup | | customWidget | JSX.Element | ❌ | Custom content to display in the viewer |

Supported File Types

The following file types are supported by Enoviq React Document Viewer.

| File Type | Base64 | URL | Blob | | ---------------- | ------ | --- | ---- | | PDF | ✔ | ✔ | ✔ | | Image | ✔ | ✔ | ✔ | | Video | ✔ | ✔ | ✔ | | Office Documents | ✔ | ✔ | ✔ | | CSV, TXT, etc. | ✔ | ✔ | ✔ |

Custom Icon

You can pass a custom widget to replace the default icon.

<ENDocumentPreview
  file={"/Images/logo.jpg"}
  customWidget={<div> Custom Icon </div>}
/>

Custom trigger to open the popup.

make a useState variable to handle the state. pass open and onClose for

   <ENDocumentPreview
        file="/Images/loginB2.jpg"
        openFile={isOpen}
        onClose={handleCloseDocument}
        customWidget={
            <>
                <h1>Document Preview</h1>
                <p>Custom header content</p>
            </>
        }
    />

Complete Example

import React, { useState } from 'react';
import ENDocumentPreview from "enoviq-react-document-viewer";

function App() {
    const [isOpen, setIsOpen] = useState(false);

    const handleOpenDocument = () => {
        setIsOpen(true);
    };

    const handleCloseDocument = () => {
        setIsOpen(false);
    };

    return (
        <div className="innerBody">
            <div className="dataBody">
                {/* Custom Trigger Button */}
                <button
                    onClick={handleOpenDocument}
                    className="open-document-btn"
                >
                    Open Document
                </button>

                {/* Document Preview */}
                <ENDocumentPreview
                    file="/Images/loginB2.jpg"
                    openFile={isOpen}
                    onClose={handleCloseDocument}
                    customWidget={
                        <>
                            <h1>Document Preview</h1>
                            <p>Custom header content</p>
                        </>
                    }
                />
            </div>
        </div>
    );
}

export default App;

Custom Styling

add this in global css

:global(:root) .body {
  /* Primary Brand */
  --react-doc-viewer-color-primary: #0070f3;
  --react-doc-viewer-color-primary-hover: #0059c1;

  /* Base Colors */
  --react-doc-viewer-color-white: #ffffff;
  --react-doc-viewer-color-black: #000000;

  /* Text Colors */
  --react-doc-viewer-color-text: #111827;
  --react-doc-viewer-color-text-muted: #6b7280;
  --react-doc-viewer-color-text-light: #9ca3af;
  --react-doc-viewer-color-text-dark: #333;
  --react-doc-viewer-color-text-error: #dc2626;
  --react-doc-viewer-color-text-error-muted: #7f1d1d;

  /* Backgrounds */
  --react-doc-viewer-color-bg: #ffffff;
  --react-doc-viewer-color-bg-muted: #f9fafb;
  --react-doc-viewer-color-bg-overlay: rgba(0, 0, 0, 0.5);
  --react-doc-viewer-color-bg-overlay-strong: rgba(0, 0, 0, 0.8);
  --react-doc-viewer-color-bg-card: #fafafa;
  --react-doc-viewer-color-bg-error: #fef2f2;

  /* Borders */
  --react-doc-viewer-color-border: #e5e7eb;
  --react-doc-viewer-color-border-light: #e0e0e0;
  --react-doc-viewer-color-border-error: #fecaca;

  /* Download Section */
  --react-doc-viewer-color-download-bg: #f9fafb;
  --react-doc-viewer-color-download-border: #d1d5db;

  /* States */
  --react-doc-viewer-color-spinner-track: #f3f4f6;
  --react-doc-viewer-color-spinner-active: #3b82f6;

  /* Shadows */
  --react-doc-viewer-shadow-soft: 0 2px 6px rgba(0, 0, 0, 0.08);
  --react-doc-viewer-shadow-medium: 0 4px 12px rgba(0, 0, 0, 0.1);
  --react-doc-viewer-shadow-strong: 0 25px 50px rgba(0, 0, 0, 0.3);
}

Best Practices

  1. State Management: Always use useState to control the popup state
  2. Error Handling: Implement error handling for file loading failures
  3. Performance: Consider lazy loading for large documents
  4. Accessibility: Ensure proper ARIA labels for screen readers
  5. Mobile Responsiveness: Test on different screen sizes