Vanilla JS Viewer Overview
pptx-vanilla-viewer is a zero-framework PowerPoint viewer: it renders .pptx slides in the browser with plain DOM and has no dependency on React, Vue, or Angular. Calling the factory function createPptxViewer(container, options) returns a viewer instance with an imperative API. The parsing engine (pptx-viewer-core) is bundled in; the shared render logic (ooxml-ui/pptx) is installed as a dependency.
The live vanilla demo is this package running without a framework.
What it provides
| Capability | Summary |
|---|---|
| Slide rendering | Text, shapes, images, groups, connectors, tables, charts, SmartArt (2D and opt-in 3D), media, ink, OLE, content parts, zoom links, and 3D models all render with dedicated renderers. |
| Navigation | Toolbar, thumbnail sidebar, keyboard navigation (arrows, PageUp/PageDown, Space, Home/End), speaker-notes panel. |
| Presentation | Fullscreen presentation mode via the real Fullscreen API (Esc exits), with media autoplay. |
| Theming | The shared ViewerTheme system (--pptx-* CSS custom properties), including the vermilion presets. See Theming. |
| Editing | Behind editable: insert, format, multi-select/group, arrange, inherited template editing, rich notes, undo/redo, and save/download. See Instance API. |
| Export | PNG, PDF, GIF, video, print, notes-page, and handout output. |
| Accessibility | Element semantics plus a presentation-wide accessibility checker with issue navigation. |
| Extensibility | An open element-renderer registry: register or override renderers per element type without forking. See Element Renderers. |
Element coverage
For a precise list of what the underlying parser supports, and what is approximated, see Limitations.
Installation
npm i pptx-vanilla-viewerThe core engine wrapper (pptx-viewer-core) is bundled in. The shared render layer (ooxml-ui/pptx), the engine (ooxml-core) and their runtime dependencies (including jszip and fast-xml-parser) are regular dependencies and install automatically. There are no framework peer dependencies; yjs (collaboration) and ai (assistant) are optional peers.
Quick example
import { createPptxViewer } from 'pptx-vanilla-viewer';
const viewer = createPptxViewer(document.getElementById('host')!, {
source: '/decks/quarterly.pptx', // URL, ArrayBuffer, Uint8Array, Blob, or File
onLoad: ({ slideCount }) => console.log(`${slideCount} slides`),
});
viewer.next();
viewer.goToSlide(3);
await viewer.enterPresentation();The container should have a size; the viewer fills it (width/height: 100%). See Getting Started for the full walkthrough.
No build step required
The package ships ESM and CJS builds. Because there is no framework, it also works from a plain <script type="module"> with an import map or a bundler-free CDN setup - anywhere modern JavaScript runs. Styles are injected automatically at construction time (a single <style id="pptx-vanilla-viewer-styles"> tag, scoped under the .pptxv root class); CSP-strict hosts can render the stylesheet themselves via getViewerCss().
Rendering philosophy: CSS, not Canvas
Like every binding in this monorepo, slides render as CSS-positioned HTML/SVG scaled with a CSS transform, not onto a Canvas. Text stays selectable and crisp at any zoom, and screen readers keep working. The tradeoffs are listed in Limitations.
Import paths
The package exposes these entry points (from package.json exports):
// Root entry - createPptxViewer, the renderer registry, theme utilities
import { createPptxViewer } from 'pptx-vanilla-viewer';
// AI assistant entry - the recommended value for the `ai` option
import { createAiAssistant } from 'pptx-vanilla-viewer/ai';| Entry | What it exports |
|---|---|
pptx-vanilla-viewer | createPptxViewer, the element renderer registry, theme utilities, the session helpers and the public types (see Key exports). |
pptx-vanilla-viewer/ai | createAiAssistant, the PptxAiAssistant handle type and the PptxAi* config types: the recommended way to pass ai (The /ai entry). |
pptx-vanilla-viewer/i18n/fr, /i18n/es, /i18n/de, /i18n/zh-CN | The bundled locale dictionaries (translationsFr and so on). |
pptx-vanilla-viewer/internals | The slide-transition helpers and playTransitionOverlay, for a custom presentation surface (API). Not covered by semver. |
pptx-vanilla-viewer/styles.css | The stylesheet the viewer otherwise injects at runtime, for CSP-strict hosts (Theming). |
Key exports
| Export | Kind | Purpose |
|---|---|---|
createPptxViewer | function | Factory: mount a viewer into a container. See Getting Started. |
PptxViewerOptions, PptxViewerCallbacks | type | Options and event callbacks. See Options & Callbacks. |
PptxViewerInstance | type | The returned handle. See Viewer Instance API. |
PptxViewerSource | type | ArrayBuffer | Uint8Array | Blob | string (URL). |
ElementRenderer, ElementRendererRegistry | type | Renderer extension surface. See Element Renderers. |
createDefaultRegistry | function | The default renderer registry (all built-in renderers pre-registered). |
createSlidesPane | function | Slide thumbnail rail for a custom shell. See API. |
renderSlideThumbnail | function | One slide drawn as the rail draws it. See API. |
getViewerCss | function | The full stylesheet as a string, for CSP-strict hosts. |
ViewerTheme, ViewerThemeColors | type | Theme configuration types. See Theming. |
vermilionLightTheme, vermilionDarkTheme | const | Built-in vermilion light/dark presets. |
themeToCssVars, defaultCssVars | function | Convert a theme to --pptx-* CSS vars. |
PptxHandler, PptxSlide, PptxElement | type | Core types re-exported for the getHandler() escape hatch. |
AccountAuthConfig, ToolbarActionId | type | Types for the accountAuth and hiddenActions options. |
rememberSessionDeck, restoreSessionDeck, forgetSessionDeck | function | Reopen the deck after a refresh. |
renderToCanvas | function | The html2canvas-pro wrapper the built-in export uses. |
PptxAiConfig, PptxAiConnection, ... | type | Types for the optional ai option. |
Next steps
- Getting Started - mount, load, navigate, present.
- Options & Callbacks - the complete
PptxViewerOptionsreference. - Viewer Instance API - every method on the returned instance.
- Theming - colours, radius, CSS vars, vermilion presets.
- Element Renderers - extend or override slide rendering.