# PowerPoint Viewer

> A React PowerPoint (.pptx) viewer with real slides, thumbnails, zoom, search, speaker notes, a single slide view and a fullscreen presenter.

- Type: React component (Media)
- Access: Pro (the source needs a Wingo UI Pro plan, see https://wingo-ui.com/pricing)
- Version: 1.0.0
- Install: `npx wingo-ui@latest add pptx-viewer`
- Docs: https://wingo-ui.com/components/pptx-viewer

## Interaction

Slides render in the browser from the .pptx itself, with nothing uploaded: layouts, masters and the theme's colors and fonts, backgrounds (solid, gradient, picture), shapes with fills, outlines, arrows, rotation and flips, grouped shapes, text with bullets, numbering, spacing and shrink-to-fit, cropped pictures, tables with their styles, bar, line, area and pie charts from the values saved in the file, and SmartArt from its saved drawing; video, audio and embedded objects show an honest labeled placeholder. Text stays real text you can select and search. Scroll through the slides as a column, or switch to one slide at a time (Single slide); only the slides near the view are drawn, so long decks stay light. The toolbar moves between slides (‹ ›, or type a number in the slide field: Enter jumps, Up / Down step, Escape cancels), zooms (- / + or a percentage, Automatic, Fit page, Fit width), searches, shows the speaker notes under the slide, starts the presenter and downloads the file; below 720px of width the switches, Present and Download move into the ⋯ menu, which also opens another .pptx (or drop one onto the viewer). The sidebar lists every slide as a thumbnail, hidden slides dimmed; arrows, Home and End move through it. In the viewer, ← → Page Up / Page Down, Home and End change slides (↑ ↓ too while a slide fits the view), Ctrl+F / ⌘F opens search: the counter reads 2 of 6, Enter / Shift+Enter jump between hits, hits in the notes open the notes. Present goes fullscreen with the hidden slides left out: click, Space, arrows or Page Up / Down to advance, Home / End, Escape to leave; on a phone swipe left or right. Pinch with two fingers, or Ctrl / ⌘ + scroll, to zoom around that point. Menus become bottom sheets on phones and slides keep their own colors in dark mode.

## Installation

```bash
npx wingo-ui@latest add pptx-viewer
```

Pro item: run `npx wingo-ui@latest login` once with a Pro account. The CLI adds the files, their dependencies and a version record for updates.

With shadcn: `npx shadcn@latest add @wingo-ui/pptx-viewer` (needs the @wingo-ui registry with your API key in components.json)

Files:

- `components/ui/pptx-viewer.tsx`

npm dependencies: `npm i fflate lucide-react`

Wingo UI dependencies (installed automatically):

- [Button](https://wingo-ui.com/components/button) ([Markdown](https://wingo-ui.com/components/button.md))
- [Dropdown Menu](https://wingo-ui.com/components/dropdown-menu) ([Markdown](https://wingo-ui.com/components/dropdown-menu.md))
- [Popover](https://wingo-ui.com/components/popover) ([Markdown](https://wingo-ui.com/components/popover.md))
- [Tooltip](https://wingo-ui.com/components/tooltip) ([Markdown](https://wingo-ui.com/components/tooltip.md))
- [useControllableState](https://wingo-ui.com/components/use-controllable-state) ([Markdown](https://wingo-ui.com/components/use-controllable-state.md))
- [Motion presets](https://wingo-ui.com/components/motion) ([Markdown](https://wingo-ui.com/components/motion.md))
- [UIProvider](https://wingo-ui.com/components/ui-config) ([Markdown](https://wingo-ui.com/components/ui-config.md))

## Usage

```tsx
import { PptxViewer } from "@/components/ui/pptx-viewer"

export function QuarterlyReviewPreview() {
  return (
    <PptxViewer
      src="/demo/q3-business-review.pptx"
      fileName="Q3 2026 business review.pptx"
      height="80dvh"
      onSlideChange={(slide) => console.log("slide", slide)}
    />
  )
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `src?` | `string` | `"/demo/q3-business-review.pptx"` | URL of the .pptx: same origin, a CORS-enabled URL or a blob: URL. Empty shows the open-a-presentation state. The playground value is the sample quarterly review (12 slides, 16:9). |
| `fileName?` | `string` | `""` | Name used for downloads and in the viewer's accessible label. Falls back to the last part of src; an uploaded file keeps its own name. |
| `defaultSlide?` | `number` | `1` | The slide it opens on, 1-based. Use slide and onSlideChange to control it. |
| `defaultLayout?` | `"continuous" \| "single"` | `"continuous"` | continuous scrolls through every slide in a column; single shows one slide at a time, fitted to the viewer, with swipe on touch. The Single slide switch changes it. |
| `defaultZoom?` | `number \| "automatic" \| "fit-page" \| "fit-width"` | `"automatic"` | The zoom each presentation opens at. "automatic" fits the slide width up to 100% in the column and the whole slide in single view; "fit-page" and "fit-width" fit the viewer; a number is a scale (1 is 100%). |
| `defaultNotesVisible?` | `boolean` | `false` | Opens with the speaker notes of the current slide shown under it. |
| `defaultSidebarOpen?` | `boolean` | `true` | Opens with the slides sidebar. It sits beside the slides from 520px of width and slides over them below, where it starts closed. Use sidebarOpen and onSidebarOpenChange to control it. |
| `maxFileSize?` | `number` | `"104857600"` | Bytes: 100 MB by default. A bigger file shows the file too large state with a download link instead of being parsed. The playground offers 100 KB, smaller than the sample, to show it. |
| `variant?` | `"surface" \| "outline" \| "plain"` | `"surface"` | surface is a raised panel, outline a bordered box, plain has no frame for app panes that bring their own. |
| `radius?` | `"none" \| "sm" \| "md" \| "lg"` | `"md"` | Corner radius of the frame: 0, 12, 16 or 24px. |
| `highlightColor?` | `string` | `"rgba(250, 204, 21, 0.4)"` | Fill of every search hit, on the slides and in the notes. Keep it translucent so the text stays readable. Also set as --pptx-viewer-highlight on the frame. |
| `activeHighlightColor?` | `string` | `"rgba(249, 115, 22, 0.55)"` | Fill of the current search hit (--pptx-viewer-active-highlight). |
| `showToolbar?` | `boolean` | `true` | The toolbar with slide navigation, zoom, search, view switches and file actions. |
| `showThumbnails?` | `boolean` | `true` | The slides sidebar and its toggle. |
| `showSearch?` | `boolean` | `true` | The search button, and Ctrl+F / ⌘F inside the viewer. Search covers the slides and the speaker notes. |
| `showLayoutSwitch?` | `boolean` | `true` | The Single slide switch in the toolbar (the ⋯ menu when narrow). |
| `showNotes?` | `boolean` | `true` | The Speaker notes switch in the toolbar (the ⋯ menu when narrow), off while the file has no notes. |
| `showPresent?` | `boolean` | `true` | The Present button (in the ⋯ menu when narrow): fullscreen, one slide at a time, hidden slides left out. |
| `showDownload?` | `boolean` | `true` | The download button (in the ⋯ menu when narrow). It saves the original file. |
| `showUpload?` | `boolean` | `true` | Open a presentation in the ⋯ menu and dropping a .pptx onto the viewer. The file opens locally; onPresentationUpload hands it to you. |
| `height?` | `number \| string` | `640` | Height of the viewer: px as a number, or any CSS length ("100%", "80dvh") to fill a pane. |
| `slide?` | `number` |  | Controls the slide in view, 1-based. Pair it with onSlideChange. |
| `onSlideChange?` | `(slideNumber: number) => void` |  | Called with the slide number when the slide in view changes: scrolling, the toolbar, the keyboard, a thumbnail, a search hit or the presenter. |
| `layout?` | `"continuous" \| "single"` |  | Controls the layout. Pair it with onLayoutChange. |
| `onLayoutChange?` | `(layout: "continuous" \| "single") => void` |  | Called when the Single slide switch changes the layout. |
| `sidebarOpen?` | `boolean` |  | Controls the slides sidebar. Pair it with onSidebarOpenChange. |
| `onSidebarOpenChange?` | `(open: boolean) => void` |  | Called when the sidebar toggle, a pick in the overlay sidebar or its backdrop opens or closes it. |
| `zoomLevels?` | `number[]` | `"[0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4]"` | Steps of the zoom menu and the - / + buttons. The first and last are the zoom limits for pinch and Ctrl / ⌘ + scroll too. |
| `toolbarActions?` | `ReactNode` |  | Your own buttons at the end of the toolbar, before the ⋯ menu: share, comment, approve. |
| `ref?` | `Ref<PptxViewerHandle> (a useRef object or an (handle) => void callback)` |  | goToSlide(slideNumber, { behavior }?), next(), previous(), getActiveSlide(), getSlides() with titles and notes for a table of contents, enterPresentation(slideNumber?), exitPresentation() and getViewportElement(). |
| `renderSlideOverlay?` | `(props: PptxViewerSlideOverlayProps) => ReactNode` |  | Draws on top of each slide in the viewer, sized to the slide at the current zoom: review pins, citations, stamps. Gets slideNumber, slideWidth, slideHeight and scale. |
| `onPresentationLoadSuccess?` | `(presentation: PptxViewerPresentation) => void` |  | Called when a presentation is ready, with its file name, slide count, slides (number, title, hidden, notes, layout), slide size and aspect ratio, and document properties (title, author, dates, company). |
| `onPresentationLoadError?` | `(error: unknown) => void` |  | Called when a presentation cannot be fetched or parsed, or is an old .ppt or password-protected file. The viewer shows the error state. |
| `onPresentationUpload?` | `(file: File) => void` |  | Called with the File someone opened or dropped, as the viewer starts showing it. |
| `onPresentingChange?` | `(presenting: boolean) => void` |  | Called when the presenter starts and ends. |
| `labels?` | `Partial<PptxViewerLabels>` |  | Every string, English by default (DEFAULT_PPTX_VIEWER_LABELS): slide, of, slideNumber, previousSlide, nextSlide, slidesSidebar, slides, slideLabel(slide), hidden, zoomIn, zoomOut, zoomLevel, fitPage, fitWidth, automatic, search, searchPlaceholder, searching, noResults, results(active, total), previousResult, nextResult, clearSearch, moreActions, singleSlide, notes, notesFor(slide), noNotes, present, exitPresentation, presentationProgress(slide, total), download, upload, presentation, loading, error, errorDescription, unsupported, tooLarge, tooLargeDescription(limit), emptyTitle, emptyDescription, noSlides, dropHere, video, audio, smartArt, embeddedObject, unsupportedImage, chart. |
| `classNames?` | `Partial<Record<"toolbar" \| "sidebar" \| "thumbnail" \| "viewport" \| "slide" \| "notes" \| "state", string>>` |  | Extra classes for the toolbar, the sidebar, each thumbnail, the scrolling viewport, each slide frame, the notes panel and the loading / empty / error states. |
| `className?` | `string` |  | Extra classes for the frame, merged last. Other div props are forwarded to it. |

## Parts

### PptxViewerHandle (type)

What the ref gets: goToSlide(slideNumber, { behavior }?), next(), previous(), getActiveSlide(), getSlides(), enterPresentation(slideNumber?), exitPresentation() and getViewportElement().

### PptxViewerPresentation (type)

What onPresentationLoadSuccess receives: fileName, slideCount, slides (PptxViewerSlideInfo[]), width and height of a slide at 100% in px, aspectRatio (16:9, 4:3, 16:10 or custom) and properties.

### PptxViewerSlideInfo (type)

A slide: number (1-based), title (the title placeholder, else its first line of text), hidden, notes (plain text) and layout name.

### PptxViewerSlideOverlayProps (type)

What renderSlideOverlay receives: slideNumber, slideWidth, slideHeight and scale.

### PptxViewerZoom (type)

A scale or "automatic" | "fit-page" | "fit-width".

### PptxViewerLayout (type)

"continuous" or "single".

### PptxViewerLabels (type)

The shape of labels: every string the viewer renders.

### DEFAULT_PPTX_VIEWER_LABELS (constant)

The English labels. Spread it to translate a few strings.

## Examples

- **Current slide outside the viewer**: onSlideChange and the slide titles from onPresentationLoadSuccess drive a caption with its own previous and next buttons (ref.previous, ref.next).
- **Table of contents**: A contents list built from the slide titles; ref.goToSlide jumps to a slide and the current one stays marked while you scroll.
- **Speaker notes**: defaultNotesVisible shows the notes under the slide; search finds text in the notes too.
- **Your own toolbar actions**: toolbarActions adds Share and Approve deck; the view switches fold into the ⋯ menu when the toolbar runs out of room.
- **On a phone**: Slides take the full width, the sidebar slides over them, menus open as bottom sheets, pinch zooms and Present goes fullscreen with swipes.
- **One slide at a time**: defaultLayout="single" fits one slide to the viewer; arrows, Page Up / Down and swipes turn the slides.
- **Empty, open a file**: Without src the viewer asks for a presentation: pick a .pptx or drop it onto the frame.
- **File too large**: maxFileSize={100 * 1024} refuses the 360 KB sample before parsing and offers the download instead.

## See also

- [PDF Viewer](https://wingo-ui.com/components/pdf-viewer) ([Markdown](https://wingo-ui.com/components/pdf-viewer.md))
- [DOCX Viewer](https://wingo-ui.com/components/docx-viewer) ([Markdown](https://wingo-ui.com/components/docx-viewer.md))
- [Excel Viewer](https://wingo-ui.com/components/excel-viewer) ([Markdown](https://wingo-ui.com/components/excel-viewer.md))
- [Carousel](https://wingo-ui.com/components/carousel) ([Markdown](https://wingo-ui.com/components/carousel.md))

---

Canonical: https://wingo-ui.com/components/pptx-viewer
More components: https://wingo-ui.com/components · Index for agents: https://wingo-ui.com/llms.txt
