PowerPoint Viewer React component for Tailwind CSS v4
v1.0.0Added in 1.4.0
A React PowerPoint (.pptx) viewer with real slides, thumbnails, zoom, search, speaker notes, a single slide view and a fullscreen presenter.
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.
PowerPoint Viewer is a Pro React component in the React media components category, written in TypeScript for React 19 and Tailwind CSS v4. It installs as source with npx wingo-ui@latest add pptx-viewer, together with Button, Dropdown Menu, Popover, Tooltip, useControllableState and 2 more and the npm packages fflate and lucide-react.
Add to a project
Requirements: React 19 and Tailwind CSS v4, in Next.js (App Router or Pages), Vite or React Router. Installation guide · Next.js setup · Vite setup
npx wingo-ui@latest add pptx-viewerPowerPoint Viewer is part of Pro, with 298 more Pro items: $8 a month or $150 once. 14-day refund before you download any Pro item. See plans
Usage
Import PptxViewer from @/components/ui/pptx-viewer.
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
srcdefault"/demo/q3-business-review.pptx"stringURL 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).
fileNamedefault""stringName 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.
defaultSlidedefault1numberThe slide it opens on, 1-based. Use slide and onSlideChange to control it.
defaultLayoutdefault"continuous""continuous" | "single"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.
defaultZoomdefault"automatic"number | "automatic" | "fit-page" | "fit-width"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%).
defaultNotesVisibledefaultfalsebooleanOpens with the speaker notes of the current slide shown under it.
defaultSidebarOpendefaulttruebooleanOpens 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.
maxFileSizedefault"104857600"numberBytes: 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.
variantdefault"surface""surface" | "outline" | "plain"surface is a raised panel, outline a bordered box, plain has no frame for app panes that bring their own.
radiusdefault"md""none" | "sm" | "md" | "lg"Corner radius of the frame: 0, 12, 16 or 24px.
highlightColordefault"rgba(250, 204, 21, 0.4)"stringFill 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.
activeHighlightColordefault"rgba(249, 115, 22, 0.55)"stringFill of the current search hit (--pptx-viewer-active-highlight).
showToolbardefaulttruebooleanThe toolbar with slide navigation, zoom, search, view switches and file actions.
showThumbnailsdefaulttruebooleanThe slides sidebar and its toggle.
showSearchdefaulttruebooleanThe search button, and Ctrl+F / ⌘F inside the viewer. Search covers the slides and the speaker notes.
showLayoutSwitchdefaulttruebooleanThe Single slide switch in the toolbar (the ⋯ menu when narrow).
showNotesdefaulttruebooleanThe Speaker notes switch in the toolbar (the ⋯ menu when narrow), off while the file has no notes.
showPresentdefaulttruebooleanThe Present button (in the ⋯ menu when narrow): fullscreen, one slide at a time, hidden slides left out.
showDownloaddefaulttruebooleanThe download button (in the ⋯ menu when narrow). It saves the original file.
showUploaddefaulttruebooleanOpen a presentation in the ⋯ menu and dropping a .pptx onto the viewer. The file opens locally; onPresentationUpload hands it to you.
heightdefault640number | stringHeight of the viewer: px as a number, or any CSS length ("100%", "80dvh") to fill a pane.
slidenumberControls the slide in view, 1-based. Pair it with onSlideChange.
onSlideChange(slideNumber: number) => voidCalled 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") => voidCalled when the Single slide switch changes the layout.
sidebarOpenbooleanControls the slides sidebar. Pair it with onSidebarOpenChange.
onSidebarOpenChange(open: boolean) => voidCalled when the sidebar toggle, a pick in the overlay sidebar or its backdrop opens or closes it.
zoomLevelsdefault"[0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4]"number[]Steps of the zoom menu and the - / + buttons. The first and last are the zoom limits for pinch and Ctrl / ⌘ + scroll too.
toolbarActionsReactNodeYour own buttons at the end of the toolbar, before the ⋯ menu: share, comment, approve.
refRef<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) => ReactNodeDraws 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) => voidCalled 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) => voidCalled 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) => voidCalled with the File someone opened or dropped, as the viewer starts showing it.
onPresentingChange(presenting: boolean) => voidCalled when the presenter starts and ends.
labelsPartial<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.
classNamesPartial<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.
classNamestringExtra classes for the frame, merged last. Other div props are forwarded to it.
Parts
PptxViewerHandle
typeWhat the ref gets: goToSlide(slideNumber, { behavior }?), next(), previous(), getActiveSlide(), getSlides(), enterPresentation(slideNumber?), exitPresentation() and getViewportElement().
PptxViewerPresentation
typeWhat 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
typeA slide: number (1-based), title (the title placeholder, else its first line of text), hidden, notes (plain text) and layout name.
PptxViewerSlideOverlayProps
typeWhat renderSlideOverlay receives: slideNumber, slideWidth, slideHeight and scale.
PptxViewerZoom
typeA scale or "automatic" | "fit-page" | "fit-width".
PptxViewerLayout
type"continuous" or "single".
PptxViewerLabels
typeThe shape of labels: every string the viewer renders.
DEFAULT_PPTX_VIEWER_LABELS
constantThe 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.
Dependencies
Files
- components/ui/pptx-viewer.tsx
FAQ
Is the React PowerPoint Viewer component free?
The preview, props and docs are free; copying the source needs a Pro plan. See plans.
How do I install PowerPoint Viewer?
Run npx wingo-ui@latest add pptx-viewer. It also adds the Wingo UI items it builds on (Button, Dropdown Menu, Popover, Tooltip, useControllableState and 2 more) and the npm packages fflate and lucide-react. With shadcn, add the @wingo-ui registry with your API key, then run npx shadcn@latest add @wingo-ui/pptx-viewer.
How does PowerPoint Viewer behave on phones?
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. Menus become bottom sheets on phones and slides keep their own colors in dark mode.
See also
Used in
More React media components
Articles using this component
- React PPTX Viewer: Slides, Notes and Presenter Mode
Component guides9 min read
New components by email
New posts, product news and occasional offers from Wingo UI. We count clicks to keep it relevant.