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.

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.