Show any document in your React app.

Word, Excel, PowerPoint, PDF and dozens more file types, drawn in the browser. Files never leave the reader's device, and there is no server to run.

npm i @openpreview/react
This is the library itself, running in your browser on report.docx. Press Ctrl+F (⌘F on a Mac) inside it to search.

What it opens

Detected from the file's bytes, not its name, so a mislabelled upload still opens with the right renderer.

Word
DOCX, DOCM, DOTX
Paged layout, styles, tables, headers and footers, footnotes, comments, charts
Excel
XLSX, XLSM, XLTX
Sheet tabs, formulas shown, merges, frozen panes, charts, conditional formatting
PowerPoint
PPTX, PPSX, POTX
Masters and layouts, 187 preset shapes, tables, charts, notes, presenter mode
PDF
PDF
pdf.js in a worker, text selection, passwords, 1,000-page files stay smooth
OpenDocument
ODT, ODS, ODP
LibreOffice files through the same Word, Excel and PowerPoint renderers
Spreadsheets and data
CSV, TSV, JSON, XML
Delimiter detection, a million rows windowed, collapsible JSON tree
Text and code
Markdown, 200+ languages, notebooks
Shiki highlighting, sanitised Markdown, Jupyter outputs, huge logs
Images
PNG, JPEG, TIFF, HEIC, SVG, EMF and more
Own TIFF and metafile decoders, multi-page scans, scripts in SVG never run
Email and archives
EML, MSG, ZIP
Messages with attachments, archives with a file tree; each opens in a nested viewer
Web and media
HTML, audio, video
Pages in a locked-down sandbox; native players for media

One component to start

Pass a File, a Blob, bytes or a URL. Toolbar, search, thumbnails, printing and keyboard support come with it. Build your own UI with the hooks when you need to.

Read about the headless hooks
import { DocViewer } from '@openpreview/react';import '@openpreview/react/styles.css';export function Preview({ file }: { file: File }) {  return <DocViewer source={file} />;}

Why in the browser

  • Private by default

    Contracts, payslips and medical records are read on the device. Nothing is sent to a conversion service.

  • No server to pay for

    No LibreOffice farm, no per-page API pricing. Static hosting is enough.

  • Fast on big files

    Parsing runs in workers, and long PDFs, sheets and logs draw only what is on screen.

  • Accessible and translatable

    Keyboard and screen-reader support, WCAG AA colours, every label translatable, right-to-left ready.