Skip to content

Component Props

<PowerPointViewer> accepts the PowerPointViewerProps interface below and emits the events in PowerPointViewerEmits. Only content is required; everything else is optional. This reference is taken directly from packages/vue/src/viewer/types.ts.

vue
<script setup lang="ts">
import { PowerPointViewer } from 'pptx-vue-viewer';
import type { PowerPointViewerProps } from 'pptx-vue-viewer';
</script>

TIP

PowerPointViewer also has a template-ref surface, see defineExpose - that is not part of PowerPointViewerProps.

Content

PropTypeDefaultDescription
contentUint8Array | ArrayBuffer(required)Raw .pptx file bytes.
filePathstring-Original file path or name. Used as a version-history label context; see Autosave.
fileNamestring-Display name of the open document, shown in the title bar.

Editing

PropTypeDefaultDescription
canEditbooleanfalseEnables editing actions (toolbar editing controls, inspector edits, inline text editing, slide management). When false, the viewer is read-only.

Events

EventPayloadDescription
@dirty-changeisDirty: booleanFired when the unsaved-changes flag flips.
@content-changecontent: Uint8ArrayFired with the re-serialised document bytes when content changes.
@autosavecontent: Uint8ArrayFired with the re-serialised bytes on each autosave cycle; see Autosave.
@active-slide-changeslideIndex: numberFired when the active slide changes.
@zoom-changezoom: numberFired when the zoom level changes.
@slide-count-changecount: numberFired when the total slide count changes (slide added/deleted).
@selection-changeelementIds: string[]Fired when element selection changes.
@mode-changemode: stringFired when the viewer mode changes (e.g. edit to present).
@start-collaborationconfig: CollaborationConfigFired when the user starts a session from the Share dialog.
@stop-collaboration-Fired when the user stops a session from the Share dialog.

content and autosave share one signature (Uint8Array payload) in the underlying PowerPointViewerEmits type, as do active-slide-change, zoom-change, and slide-count-change (all number payloads).

No onOpenFile event

File > Open is a prop, not an event: onOpenFile?: () => void (see below), matching React's callback-prop shape rather than the emit convention used elsewhere in this component.

Presentation / authoring

PropTypeDefaultDescription
authorNamestring-Display name used as the author for comments and annotations. Falls back to collaboration.userName when collaborating, otherwise 'You'.
classstring-Optional class name applied to the viewer root element (props key is class, not className).
smartArt3DbooleanfalseOpt in to the experimental Three.js SmartArt renderer (extruded 3D blocks on WebGL). Requires the optional three peer; falls back to SVG without it.
onOpenFile() => void-Host override for the File > Open action: bypasses the built-in file picker; the host then supplies a new content prop instead.

Theming

PropTypeDefaultDescription
themeViewerTheme-Theme configuration: partial color overrides, a custom radius, and arbitrary cssVars. Unset values fall back to the built-in dark theme. See Theming.
vue
<PowerPointViewer
	:content="bytes"
	:theme="{ colors: { primary: '#6366f1', background: '#0f172a' }, radius: '0.75rem' }"
/>

Collaboration

These props enable and control real-time co-editing. See Collaboration for the full flow and the CollaborationConfig shape.

PropTypeDefaultDescription
collaborationCollaborationConfig-When provided, enables collaborative editing with live cursors, presence, and Yjs CRDT sync. Requires the yjs and y-websocket/y-webrtc peers.
shareDefaults{ roomId?: string; userName?: string; serverUrl?: string }-Default values for the Share dialog fields. If omitted, the fields start empty.

Starting/stopping a session is controlled via the @start-collaboration / @stop-collaboration events above: the host sets/clears the collaboration prop in response.

Full interface

ts
interface PowerPointViewerProps {
	content: Uint8Array | ArrayBuffer;
	filePath?: string;
	fileName?: string;
	canEdit?: boolean;
	autosave?: boolean;
	autosaveIntervalMs?: number;
	class?: string;
	authorName?: string;
	theme?: ViewerTheme;
	collaboration?: CollaborationConfig;
	shareDefaults?: { roomId?: string; userName?: string; serverUrl?: string };
	onOpenFile?: () => void;
	smartArt3D?: boolean;
}

interface PowerPointViewerEmits {
	(e: 'dirty-change', isDirty: boolean): void;
	(e: 'content-change' | 'autosave', content: Uint8Array): void;
	(e: 'active-slide-change' | 'zoom-change' | 'slide-count-change', value: number): void;
	(e: 'mode-change', mode: string): void;
	(e: 'selection-change', elementIds: string[]): void;
	(e: 'start-collaboration', config: CollaborationConfig): void;
	(e: 'stop-collaboration'): void;
}

Autosave

Autosave is opt-in and host-driven: unlike some editors that persist to browser storage on their own, pptx-vue-viewer debounces slide changes and hands the serialised bytes back to the host via @autosave; the host decides where they go.

PropTypeDefaultDescription
autosavebooleanfalseEnables the debounced autosave timer. Also requires canEdit.
autosaveIntervalMsnumber2000Debounce window (ms) between the last edit and the @autosave emit.
vue
<PowerPointViewer
	:content="bytes"
	can-edit
	autosave
	:autosave-interval-ms="5000"
	@autosave="persist"
/>

The title bar exposes an AutoSave toggle the user can switch off at runtime; toggling it off stops new saves without discarding anything already emitted. Each autosave cycle also captures an in-memory, session-scoped version-history snapshot (see the Version History panel), separate from the @autosave payload itself.

No built-in persistence or recovery

This differs from the React binding's IndexedDB-backed autosave/recovery flow: the Vue viewer does not write to IndexedDB and has no built-in "recover an unsaved session" prompt. If you need that behaviour, persist the @autosave bytes yourself (e.g. to IndexedDB, localStorage, or your backend) and re-supply content on reload.

Released under the Apache-2.0 License.