Skip to content

React Viewer Overview ​

pptx-react-viewer is a React 18 or 19 component for rendering and editing .pptx files. It is built on pptx-viewer-core and includes the toolbar, inspector panels, slide canvas, animation engine, presentation mode, real-time collaboration, and export.

The full editor: ribbon, slide thumbnails, canvas, and inspector panel

What it provides ​

CapabilitySummary
ViewerRenders slides with 16 element types (shapes, text, images, tables, 23 chart types, SmartArt, connectors, media, ink, OLE, 3D models, zoom).
WYSIWYG editorInsert / move / resize / delete elements, inline text editing, style editing, slide management - gated behind canEdit.
PresenterFullscreen slideshow with 39 animation presets and 26 motion paths, 57 transitions (including morph), speaker notes, presenter view with timer.
ExportPNG / SVG / PDF / GIF / video / JSON slide export, plus save-as PPTX. See Export.
CollaborationReal-time multi-user editing via Yjs CRDT with presence tracking, remote cursors, and avatars. See Collaboration.

Element coverage

For a precise list of what the underlying parser/serializer supports - and what is approximated - see Limitations.

Installation ​

bash
npm i pptx-react-viewer

The core engine (pptx-viewer-core) is bundled in, so you don't install it separately; add it only if you also want to use the framework-agnostic engine directly.

Peer dependencies (you provide these in your app):

  • react and react-dom ^18.2 or ^19 (both majors are covered by their own CI test run)
  • framer-motion, lucide-react, react-icons
  • jspdf, jszip, fast-xml-parser
  • i18next, react-i18next

Optional dependencies (only needed for specific features):

  • three - GLB/GLTF 3D models plus opt-in 3D SmartArt and 3D chart renderers
  • yjs, y-websocket - real-time collaboration (relay transport)
  • y-webrtc - serverless peer-to-peer collaboration

TIP

3D and collaboration features degrade gracefully. Without three, 3D models fall back to their poster image. Without yjs/y-websocket, the viewer runs in single-user mode.

Import paths ​

The package exposes these entry points (from package.json exports):

tsx
// Root entry - viewer, theme utilities, renderToCanvas
import { PowerPointViewer } from 'pptx-react-viewer';
// AI assistant entry - the recommended value for the `ai` prop
import { createAiAssistant } from 'pptx-react-viewer/ai';
// Viewer sub-entry - same component PLUS the opt-in hooks/components surface
import { PowerPointViewer } from 'pptx-react-viewer/viewer';
EntryWhat it exports
pptx-react-viewerPowerPointViewer, theme utilities, renderToCanvas and the public types.
pptx-react-viewer/no-i18nextThe root entry's exports, never importing i18next or react-i18next (Without react-i18next).
pptx-react-viewer/viewerThe same component plus the opt-in hooks and collaboration components (Hooks).
pptx-react-viewer/aicreateAiAssistant, the PptxAiAssistant handle type and the PptxAi* config types: the recommended way to pass ai (The /ai entry).
pptx-react-viewer/i18nThe English dictionary, keyToLabel and the locale catalogue (Localization).
pptx-react-viewer/i18n/fr, /i18n/es, /i18n/de, /i18n/zh-CN, /i18n/ja, /i18n/koThe bundled locale dictionaries (translationsFr and so on).
pptx-react-viewer/internalsThe internal hooks PowerPointViewer composes. Not covered by semver.
pptx-react-viewer/styles (or /styles.css)The bundled stylesheet.
pptx-react-viewer/canvas.cssA smaller stylesheet for a read-only SlideCanvas (Getting Started).
pptx-react-viewer/theme.cssThe Tailwind CSS v4 @theme tokens, for a host that builds the viewer's utilities into its own stylesheet.

Both . and ./viewer export PowerPointViewer. The pptx-react-viewer/viewer entry additionally exposes the opt-in, tree-shakeable hooks and collaboration components (see Hooks). Use the root entry for the common case.

Rendering philosophy: CSS, not Canvas ​

Slides are rendered with CSS positioning and transforms (scaled HTML/SVG), not an HTML Canvas. This provides:

  • Crisp text at any zoom level
  • Native browser text selection and accessibility
  • DOM-based interaction (click, drag, resize hit-testing)
  • Standard CSS effects (shadows, gradients, borders)

The tradeoff is that some visual effects are approximated (backdrop-filter, mix-blend-mode, CSS 3D, path gradients). Raster export goes through html2canvas, which has its own constraints. The full list lives in Limitations.

Hooks-based architecture ​

The component is a forwardRef orchestrator. Its logic is decomposed into 80+ custom hooks composed inside PowerPointViewer.tsx; the visual components are almost purely presentational. Most hooks are internal architecture, but a curated, tree-shakeable subset is exported from pptx-react-viewer/viewer for advanced integrations. See Hooks for which are public API.

Key exports ​

ExportKindPurpose
PowerPointViewercomponentThe main viewer/editor component.
PowerPointViewerPropstypeProps interface. See Props.
PowerPointViewerHandletypeImperative ref API. See Handle.
renderToCanvasfunctionRender a DOM element to a Canvas with an oklch-colour workaround. See Export.
getAnimationInitialStylefunctionCompute the pre-animation initial CSS for an animation preset.
ViewerTheme, ViewerThemeColorstypeTheme configuration types. See Theming.
defaultThemeColors, defaultRadiusconstBuilt-in dark-theme defaults.
themeToCssVars, defaultCssVarsfunctionConvert a theme to --pptx-* CSS vars.
ViewerThemeProvider, useViewerThemeprovider/hookAdvanced theme context.
Toolbar, SlideCanvas, SlidesPanecomponentThe flat toolbar, canvas and slide thumbnail rail that PowerPointViewer renders internally, for custom layouts. See Hooks.
useViewerBuildingBlockshookWires the document, selection and export state into Toolbar, SlideCanvas and SlidesPane props. See Hooks.

Next steps ​

Released under the Apache-2.0 License.