Skip to content

Component Props ​

For custom host sizing, see Viewport fitting for fitPadding, maxFitScale, framework-specific examples, and default values.

<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.

Display ​

These match the Svelte and vanilla bindings; the defaults and clamping are shared.

PropTypeDefaultDescription
initialSlidenumber0Zero-based slide shown after each load, clamped into the deck. Changing it later applies to the next load, not the current slide.
googleFontsfalse | { baseUrl: string }unsetGoogle Fonts fallback for deck fonts that are neither installed nor embedded. Unset leaves it to File > Options > Trust Center > "Download fonts that are not installed or embedded" (on by default: loads them from fonts.googleapis.com); false sends no request to Google (text uses installed, embedded or fallback fonts) and locks that option off; { baseUrl } sends the CSS2 request to a self-hosted mirror instead and locks it on (an invalid baseUrl turns the fallback off and locks it off). See Fonts and privacy.
allowExternalContentbooleanunsetHost switch for content a deck links from another server (http(s) targets): pictures, picture fills and bullets, video, audio and poster frames. Unset follows PowerPoint: nothing is fetched on open and a security bar offers Enable Content for that presentation, unless the user turned on File > Options > Trust Center > "Allow external content" (off by default). false fetches none of it and shows no bar, true fetches it without asking; either value locks the Trust Center option to match. Enable Content and a change of this value apply at once: the deck redraws without reloading and keeps its undo history. Google Fonts requests are separate (googleFonts). See External content and privacy.
listConversionScope'paragraph' | 'list''paragraph'How far Bullets / Numbering reach from a bare caret. 'paragraph' converts only the caret's paragraph, as in PowerPoint. 'list' makes a caret that switches a list paragraph between bullets and numbering convert the whole list around it (adjacent items at its level and the deeper items nested between them), as in Word and Google Docs. Turning a list off, listing a plain paragraph and range selections are the same in both modes.
limitsPptxLoadLimitsunsetBounds on loading a deck, for hosts that show untrusted decks: maxInputBytes, maxUncompressedBytes, maxEntries, maxSlides, maxShapes. Unset keeps the core defaults (500 MiB inflated, 65,536 ZIP entries, nothing else bounded). A deck over a limit shows the load-error screen with the limit and the deck's value. A change applies from the next load. See Load limits.
showToolbarbooleantrueShow the editor chrome: title bar, ribbon and toolbar, protected-view and read-only banners, the mobile toolbar and the status bar. false leaves the canvas (and the thumbnail pane, if shown).
ribbonDisplay'always' | 'tabs' | 'fullScreen''always'PowerPoint's Ribbon Display Options: 'always' docks tabs and commands, 'tabs' shows the tab row and lays a tab's commands over the slide when it is chosen, 'fullScreen' hides the title bar and the ribbon behind a strip at the top. The user changes it from the menu at the right end of the tab row, with Ctrl+F1 or a double click on a tab; changing the value from the host switches the mode.
showThumbnailsbooleantrueShow the slide thumbnail pane. It still follows the user's own collapse toggle and the slidesPane customisation panel.
showCompatibilityToastsbooleantrueShow the compatibility warning toast stack after a load. false hides the stack only; the warnings are still collected. Independent of showToolbar.
vue
<PowerPointViewer
	:content="bytes"
	:initial-slide="2"
	:show-toolbar="false"
	:show-thumbnails="false"
/>

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.
@ribbon-display-changemode: 'always' | 'tabs' | 'fullScreen'Fired when the user picks a Ribbon Display Options mode. Not fired when the host changes the value. The viewer keeps the choice for its own lifetime only; store it to bring it back on the next visit.
@slide-count-changecount: numberFired when the total slide count changes (slide added/deleted).
@selection-changeelementIds: string[]Fired when element selection changes.
onElementRenderError(error: Error, context: ElementRenderErrorContext) => voidA prop (so @element-render-error binds it too). A slide element was omitted because its renderer threw; context is { elementId, elementType, slideId }. Only that element is left out, on every surface. Defaults to console.error(error, context), also used when the callback throws.
@mode-changemode: stringFired when the viewer mode changes (e.g. edit to present).
@change-Fired after any committed document edit (move, resize, text, undo, redo, ...).
@autosave-toggleenabled: booleanFired when the user enables or disables autosave (title bar or File > Options).
@autosave-status'idle' | 'saving' | 'saved' | 'error'Fired on every autosave lifecycle transition.
@autosave-recoveryrecord: AutosaveRecordFired when a recovery snapshot left by a previous session is found.
@properties-changeupdates: Partial<PptxCoreProperties>Fired when the user (or the AI assistant) changes the document properties.
@notes-updatenotes: stringFired with the new speaker-notes text after a notes edit.
@presentation-changepresenting: booleanFired when presentation (slide show) mode is entered or left.
@collaboration-statusstatus: ConnectionStatusFired on every collaboration connection-status transition.
@start-collaborationconfig: CollaborationConfigFired when the user starts a session from the Share dialog.
@collaboration-changestate: CollaborationStateFired when a session starts or stops, and when its status, synced flag or people change.
@loaddetail: ViewerLoadDetailFired each time a presentation finishes loading without an error (slideCount, canvasSize).
@errormessage: stringFired once per distinct load failure, with a human-readable message.
@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 Three.js SmartArt renderer (extruded 3D blocks on WebGL). Requires the optional three peer; falls back to SVG without it.
surfaceChart3D, barChart3D, lineChart3D, areaChart3D, pieChart3DbooleanfalseIndependently opt in to interactive Three.js renderers for the matching 3D chart kinds. Each falls back to SVG when three is unavailable or the chart cannot render as a WebGL scene.
aiPptxAiAssistant | PptxAiConfig-Enables the optional AI assistant: pass createAiAssistant(config) from pptx-vue-viewer/ai, or a plain PptxAiConfig. Its SDK peers load only when the panel is opened; omit this prop to leave the assistant unavailable.
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' }"
/>

Fonts, themes, locales and host extensions ​

PropTypeDescription
fontsViewerFontSource[]Licensed font sources supplied by the host. No fonts are bundled.
defaultThemeKeystringInitial theme key for File > Options > Theme.
availableThemesThemeCatalogEntry[]Theme choices offered by File > Options.
onThemeChange(key: string) => voidCalled when the user picks a theme; the host then owns persisting the choice.
defaultLocalestringInitial locale code for File > Options > Language.
availableLocalesLocaleCatalogEntry[]Locale choices offered by File > Options > Language.
onLocaleChange(code: string) => voidCalled when the user picks a language; the host then owns applying and persisting it.
accountAuthAccountAuthConfigHook point for File > Account's sign-in section; disabled by default.
onHyperlinkClickHyperlinkClickHandlerFunction prop (not an event). Called before following a link; return false to cancel the default action.
ribbonAddInsreadonly RibbonAddInTab[]Ribbon tabs the host adds after Help. Each command runs its run callback and dispatches a bubbling office-ribbon-add-in event.
inspectorInitiallyOpenbooleanInitial inspector visibility; omitted keeps the desktop/mobile default.

UI customization ​

PropTypeDefaultDescription
customizationViewerCustomization-Hide, lock or remap any part of the chrome: ribbon tabs and buttons, File > Options pages, sections and settings (lock a value, set a default), File tab pages and cards, context-menu entries, editor shortcuts, panels, features (AI, collaboration) and dialogs. Unioned with hiddenActions. A new object replaces the whole customisation.
vue
<PowerPointViewer
	:content="bytes"
	can-edit
	:customization="{ ribbon: { hiddenTabs: ['draw'] }, disabledFeatures: ['ai'] }"
/>

The same helpers (hideRibbonTab, lockSetting, remapShortcut, ...) are available on the template ref to change it at runtime; see the API page. Every id, the rules and recipes are in the UI Customization guide.

Collaboration ​

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

PropTypeDefaultDescription
collaborationCollaborationInput-When provided, enables collaborative editing with live cursors, presence, and Yjs CRDT sync. Takes the legacy CollaborationConfig or the shared CollaborationOptions. Requires the optional yjs peer; y-websocket and y-webrtc ship as optional dependencies.
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;
	initialSlide?: number;
	googleFonts?: false | { baseUrl: string };
	allowExternalContent?: boolean;
	listConversionScope?: 'paragraph' | 'list';
	limits?: PptxLoadLimits;
	showToolbar?: boolean;
	ribbonDisplay?: 'always' | 'tabs' | 'fullScreen';
	showThumbnails?: boolean;
	showCompatibilityToasts?: boolean;
	autosave?: boolean;
	autosaveIntervalMs?: number;
	class?: string;
	authorName?: string;
	theme?: ViewerTheme;
	collaboration?: CollaborationInput;
	shareDefaults?: { roomId?: string; userName?: string; serverUrl?: string };
	onOpenFile?: () => void;
	onHyperlinkClick?: HyperlinkClickHandler;
	onThemeChange?: (key: string) => void;
	onLocaleChange?: (code: string) => void;
	fonts?: ViewerFontSource[];
	fitPadding?: ViewportFitPadding;
	maxFitScale?: number | null;
	defaultThemeKey?: string;
	availableThemes?: ThemeCatalogEntry[];
	defaultLocale?: string;
	availableLocales?: LocaleCatalogEntry[];
	accountAuth?: AccountAuthConfig;
	hiddenActions?: ToolbarActionId[];
	ribbonAddIns?: readonly RibbonAddInTab[];
	inspectorInitiallyOpen?: boolean;
	customization?: ViewerCustomization;
	smartArt3D?: boolean;
	surfaceChart3D?: boolean;
	barChart3D?: boolean;
	lineChart3D?: boolean;
	areaChart3D?: boolean;
	pieChart3D?: boolean;
	ai?: PptxAiConfig;
}

interface PowerPointViewerEmits {
	(e: 'dirty-change', isDirty: boolean): void;
	(e: 'content-change' | 'autosave', content: Uint8Array): void;
	(e: 'change'): void;
	(e: 'autosave-toggle', enabled: boolean): void;
	(e: 'autosave-status', status: 'idle' | 'saving' | 'saved' | 'error'): void;
	(e: 'autosave-recovery', record: AutosaveRecord): void;
	(e: 'properties-change', updates: Partial<PptxCoreProperties>): void;
	(e: 'notes-update', notes: string): void;
	(e: 'presentation-change', presenting: boolean): void;
	(e: 'collaboration-status', status: ConnectionStatus): 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;
	(e: 'collaboration-change', state: CollaborationState): void;
	(e: 'load', detail: ViewerLoadDetail): void;
	(e: 'error', message: string): void;
}

Autosave ​

pptx-vue-viewer writes a crash-recovery snapshot, once per interval while there are unsaved edits, to the shared IndexedDB store, and hands the serialised bytes back to the host via @autosave.

PropTypeDefaultDescription
autosavebooleantrueRecovery autosave. A policy ceiling over the title-bar toggle; see below.
autosaveIntervalMsnumberFile > Options cadenceInterval (ms) between recovery snapshots while there are unsaved edits. An explicit value outranks the user's AutoRecover setting.
storageDocumentStoragenoneHost-owned storage: Save goes to storage.save(), recovery copies to its recovery methods. See Host-owned storage.
readOnlybooleanfalseMakes the deck read-only. true wins over canEdit; false only lifts this restriction.
fileProvidersreadonly CloudFileProvider[]-Cloud places for File > Open (for example OneDrive). A file opened from one saves back to that place instead of storage.

Who decides: the autosave prop or the AutoSave toggle? ​

The rule is the same in all five bindings and lives in one shared decision function, resolveAutosaveActivation:

The autosave prop is a policy ceiling. The title-bar AutoSave toggle is the user's preference inside it.

autosaveWhat runsThe toggle
omittedAutosave runs; the user's toggle decides, defaulting to on.Works.
trueSame as omitted: the host permits it, the user decides.Works.
falseAutosave is off, and no recovery prompt is offered on load.Inert (it must not move).

A preference can never exceed a policy, which is why autosave: false also takes the switch away: a control that silently does nothing is worse than no control. canEdit/editable and a filePath key remain hard requirements either way.

The same rule governs the cadence: an explicit autosaveIntervalMs is a host policy honoured as given, and omitting it follows the user's File > Options > Save > "Save AutoRecover information every N minutes" (two minutes by default).

The default is true because crash recovery that is off by default is crash recovery nobody has.

Recovering a snapshot ​

When a deck finishes loading and a snapshot newer than 24 hours exists for the same key, the viewer raises a "Recover unsaved changes?" dialog offering Restore or Discard. Restore loads the snapshot's bytes; Discard deletes it. It is deliberately not raised for a snapshot this tab has already taken delivery of (for example when the host itself restored it through restoreSessionDeck).

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.

Persistence and recovery prompt

Each autosave cycle also writes the bytes to the shared IndexedDB recovery store (the same store React, Angular, Svelte and vanilla use), so File > Open's "Recent" list and File > Account's Storage & Privacy panel report real data. Those snapshots are stored as a plain ZIP even for a password-protected deck, so recovery can read them back without a password.

Vue also shows the "recover an unsaved session" prompt on load (AutosaveRecoveryDialog), matching every other binding.

Released under the Apache-2.0 License.