
Security News
OpenClaw Skill Marketplace Emerges as Active Malware Vector
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.
react-doc-viewer
Advanced tools
npm i react-doc-viewer
# or
yarn add react-doc-viewer
npmjs.com/package/react-doc-viewer-plugins
If you want to only create your own custom file renderers you can skip this step.
Otherwise, install react-doc-viewer-plugins to use the included renderers.
You will still be able to create custom file renderers.
npm i react-doc-viewer-plugins
# or
yarn add react-doc-viewer-plugins
Warning - By default the component height will expand and contract to the current loaded file. The width will expand to fill the parent.
DocViewer requires at least an array of document objects to function. Each document object must have a uri to a file, either a url that returns a file or a local file.
import DocViewer from "react-doc-viewer";
// Don't forget to import included renderers / custom renderers
import "react-doc-viewer-plugins";
function App() {
const docs = [
{ uri: "https://url-to-my-pdf.pdf" },
{ uri: require("./example-files/pdf.pdf") }, // Local File
];
return <DocViewer documents={docs} />;
}
You can provide a theme object with one or all of the available properties.
<DocViewer
documents={docs}
theme={{
primary: "#5296d8",
secondary: "#ffffff",
tertiary: "#5296d899",
text_primary: "#ffffff",
text_secondary: "#5296d8",
text_tertiary: "#00000099",
disableThemeScrollbar: false,
}}
/>
Any styling applied to the <DocViewer> component, is directly applied to the main div container.
<DocViewer documents={docs} className="my-doc-viewer-style" />
Each component / div already has a DOM id that can be used to style any part of the document viewer.
#react-doc-viewer #header-bar {
background-color: #faf;
}
<DocViewer documents={docs} style={{width: 500, height: 500}} />
import styled from "styled-components";
//...
<MyDocViewer documents={docs}/>
//...
const MyDocViewer = styled(DocViewer`
border-radius: 10px;
`
You can provide a config object, which configures parts of the component as required.
<DocViewer documents={docs} config={{
header: {
disableHeader: false,
disableFileName: false
}
}} />
Please visit the plugins package for instructions on contributing to document renderers.
npmjs.com/package/react-doc-viewer-plugins#contributing
DocViewer props| name | type |
|---|---|
| documents | IDocument[] |
| className? | string |
| style? | React.CSSProperties |
| config? | IConfig |
| theme? | ITheme |
IDocument| name | type |
|---|---|
| uri | string |
| fileType? | string - Used Internally - Ignored if passed into props |
| base64Data? | string - Used Internally - Ignored if passed into props |
IConfig| name | type |
|---|---|
| header? | IHeaderConfig |
IHeaderConfig| name | type |
|---|---|
| disableHeader? | boolean |
| disableFileName? | boolean |
ITheme| name | type |
|---|---|
| primary? | string |
| secondary? | string |
| tertiary? | string |
| text_primary? | string |
| text_secondary? | string |
| text_tertiary? | string |
| disableThemeScrollbar? | boolean |
DocRenderer| name | type |
|---|---|
| fileTypes | string[] |
| priority | number |
npm i && npm run start
# or
yarn && yarn start
FAQs
Document viewer for react. Renders online/local documents.
The npm package react-doc-viewer receives a total of 27,138 weekly downloads. As such, react-doc-viewer popularity was classified as popular.
We found that react-doc-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Security researchers report widespread abuse of OpenClaw skills to deliver info-stealing malware, exposing a new supply chain risk as agent ecosystems scale.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.