Skip to content

Complete Hooks Reference ​

This is the complete list referenced from the Hooks page: every hook that composes PowerPointViewer internally, grouped by concern. For the small curated subset that has a semver-stable public API, see Hooks -> Public hooks instead.

Internal building blocks

All of the hooks below are importable from pptx-react-viewer/internals, but the name is literal: they are not covered by semver, so signatures, behavior, and existence can change without a major bump. Reach for this entry only when the curated pptx-react-viewer/viewer export and the public PowerPointViewer props/handle genuinely can't do what you need. Pin an exact version if you depend on it.

tsx
import { useViewerState, useEditorHistory } from 'pptx-react-viewer/internals';

Core state & lifecycle ​

HookConcern
useViewerStateComposite state hook (composes core + UI state).
useViewerCoreStateDocument state: slides, selection, canvas size, mode.
useViewerUIStateUI state: panel visibility, dialog flags, toolbar flags.
useDerivedSlideStateComputed visible indexes, sections, master pseudo-slide.
useDerivedElementStateComputed per-element derived state (bounds, handles, z-order).
useContentLifecycleContent sync, dirty tracking, recovery detection wiring.
useLoadContentParses the PPTX buffer on mount via PptxHandler.
useRecoveryDetectionDetects a prior unsaved session to offer recovery.
useAutosavePeriodic autosave scheduling and status.
useSerializeSerializes the current document back to bytes.
useViewerIntegrationTop-level integration: I/O, export, print, pointers, lifecycle.

Editing & history ​

HookConcern
useEditorHistoryUndo/redo snapshot stack with deferred capture during pointer interactions.
useEditorOperationsComposes all editor operations into one result.
useElementOperationsElement create/update/delete primitives.
useElementManipulationMove / resize / rotate / delete elements.
useSectionOperationsSection (slide grouping) create/rename/delete.
useTableOperationsRow/column insert/delete, merge/split cells.
useSlideManagementAdd / delete / duplicate / reorder / hide slides.
useInsertElementsShape / image / text box / table / chart insertion.
useGroupAlignLayerHandlersGroup/ungroup, align/distribute, layer (front/back) operations.
useMergeShapesHandlerBoolean shape merge (union/subtract/intersect/exclude).
usePropertyHandlersProperty-panel change handlers for selected elements.
useThemeHandlersApplying/switching the document's PowerPoint theme.
useThemeSwitchingHigher-level theme switch orchestration (also public, see below).
useLayoutSwitchingSwitching a slide's layout while remapping placeholders.
useClipboardHandlersCopy / cut / paste of elements.
useFindReplaceFind & replace across slide text.
useCommentsComment thread state and CRUD.
useAnnotationHandlersFreehand/shape annotation drawing handlers.

Canvas interaction ​

HookConcern
usePointerHandlersMouse/touch event processing for the canvas.
useCanvasInteractionsSelection box, drag-select, canvas-level gestures.
useZoomViewportZoom level, fit-to-width, viewport DOM ref.
useKeyboardShortcutsHotkey definitions.
useKeyboardShortcutWiringWires hotkey definitions to DOM event listeners.
useResizablePanelsResizable inspector/sidebar panel widths.
useSheetDismissDragSwipe-to-dismiss for bottom sheets (mobile).
useModalDismissDragSwipe-to-dismiss for modals (mobile).

Export, print & I/O ​

HookConcern
useExportHandlersPNG / SVG / PDF / GIF / video / PPTX export logic.
useExportSaveAs"Save as" file-picker flow around export.
usePrintHandlersPrint dialog and layout.
useIOHandlersOpen/import file handling.
useFontInjectionInjects embedded document fonts into the page.
useVirtualizedSlides (+ computeVirtualRange)Virtualizes the slide panel/list for large decks.

Dialogs ​

HookConcern
useViewerDialogsOpen/close state for every modal dialog.
useDialogCustomShowsCustom "show" gating logic for specific dialogs.

Presentation mode ​

HookConcern
usePresentationModeSlideshow navigation, animation, transitions (top-level composer).
usePresentationSetupPresentation-mode entry setup (fullscreen, initial slide).
usePresentationAnnotationsPen/highlighter annotations while presenting.
useAnimationPlaybackPlays back element animation timelines.
useRehearsalTimingsRecords per-slide timings during a rehearsal pass.
usePresentationKeyboardKeyboard navigation while presenting.
useSlideNavigationNext/previous/jump slide navigation.
useZoomNavigationZoom/pan while presenting.
usePresenterWindowPresenter-window <-> audience-window messaging.
useAudienceModeAudience-window-side rendering mode.

Slide-transition helpers ​

pptx-viewer-shared (the framework-agnostic logic every binding bundles) is a private, unpublished workspace package: it is never on npm, so code outside this monorepo cannot import from it directly. A host embedding its own presentation stage (a custom SlideStage instead of the full PowerPointViewer) still needs the transition resolver/keyframes, so the whole surface is re-exported here instead:

ExportConcern
resolveSlideTransitionResolve a PptxSlideTransition to CSS animation shorthands for the outgoing/incoming layers.
resolveTransitionDurationMsEffective duration (ms) for a transition, honoring an authored duration, the legacy spd token, and PowerPoint's own defaults.
getSlideTransitionAnimationsLower-level resolver resolveSlideTransition calls internally (classic 2-D transition family).
getCinematicTransitionAnimations / getP14TransitionAnimationsThe Office 2013+ (p15) cinematic family and the Office 2010 (p14) exotic/3-D family, respectively.
SLIDE_TRANSITION_KEYFRAMES (alias SLIDE_TRANSITION_KEYFRAMES_CSS)The full @keyframes block every resolved animation name above references. Inject once via a <style> tag.
CINEMATIC_TRANSITION_KEYFRAMES / P14_TRANSITION_KEYFRAMES_ALLThe keyframe sub-blocks already folded into SLIDE_TRANSITION_KEYFRAMES; exported individually too.
resolveDirection / resolveDirection8 / resolveOrientationNormalize an OOXML dir/orient token to a resolved direction/orientation.
resolveWheelSpokeCountSnap an authored Wheel spoke count to the nearest PowerPoint-offered value.
RANDOM_ELIGIBLE_TYPES, INSTANT, DEFAULT_TRANSITION_DURATION_MS, DEFAULT_MORPH_DURATION_MS, TRANSITION_SPEED_DURATION_MS, EASE, WHEEL_SPOKE_COUNTSSupporting constants used by the resolvers above.
PresentationTransitionOverlay, MorphTransitionOverlay, SlideLayer, FragmentedTransitionLayerThe presentation-mode transition overlay components themselves, for a host that wants the whole rendered overlay rather than just the CSS resolver.

Collaboration ​

See Collaboration for the curated public subset. The full internal set:

HookConcern
useYjsProviderManages the Yjs WebSocket provider lifecycle.
useYjsDocumentSyncSyncs the Yjs document into viewer state.
usePresenceTrackingTracks remote cursors, selection, and connection status.
useCollaborativeStateCRDT-backed shared document state.
useCollaborativeHistoryCollaborative undo/redo.
useBroadcastFollowerFollows another user's viewport/selection broadcast.
useFollowMode"Follow presenter" mode orchestration.

Mobile & responsive ​

HookConcern
useIsMobileDevice/viewport classification (mobile/tablet/orientation).
useTouchGesturesPinch-zoom, pan, and tap-gesture recognition.
useKeyboardInsetsAdjusts layout for the on-screen keyboard (mobile).
useSwipeNavigationSwipe-to-change-slide navigation (mobile).
useReducedMotionRespects prefers-reduced-motion for animations/transitions.

This list is generated from packages/react/src/viewer/hooks/**/*.ts and re-exported in full from pptx-react-viewer/internals. If you add or rename a hook there, update this page in the same change.

Released under the Apache-2.0 License.