SlideDeck
slide-deckFullscreen presentation player with aspect-ratio scaling, slide transitions, incremental fragments, overview grid, and sync.
Usage
Basic Playback & Fragments
Reuses FitScreen for 16:9 scaling; slide 2 includes a 3-step SlideFragment reveal with keyboard navigation and floating controls.
Online HTML Enhanced Slide Engine
Aspect Scaling · Fragments · Overview Grid · Dual-Screen Sync
<div className="aspect-video w-full overflow-hidden rounded border border-border">
<SlideDeck
slides={[
{ id: "cover", title: "Cover", content: <CoverSlide /> },
{
id: "agenda",
title: "Agenda",
stepsCount: 2,
content: (
<div>
<SlideFragment step={1}>First item</SlideFragment>
<SlideFragment step={2}>Second item</SlideFragment>
</div>
),
},
]}
transition="fade"
/>
</div>Overview Grid Quick Jump
Press G or click the overview button to tile all slide thumbnails and jump directly.
<SlideDeck slides={slides} defaultOverview />When to use
Use SlideDeck to present HTML-enhanced slide decks, product keynotes, or interactive lecture slides. It wraps each slide in FitScreen to preserve 16:9 or 4:3 proportions, syncs across windows with PresenterView via channelName, and accepts StageDraw inside the overlay slot for live annotations and laser pointing.
- For marketing or e-commerce card carousels use Carousel.
- For a single scaled dashboard canvas use FitScreen.
Import
import { SlideDeck, SlideFragment, useSlideStep } from "@hulianui/ui"Props
| Name | Type | Default | Description |
|---|---|---|---|
| slides* | SlideDeckItem[] | — | Array of slide definitions |
| index | number | — | Controlled current slide index (0-based) |
| defaultIndex | number | 0 | Uncontrolled initial slide index |
| step | number | — | Controlled fragment reveal step (0-based) |
| defaultStep | number | 0 | Uncontrolled initial fragment step |
| designWidth | number | 1920 | Inner FitScreen design canvas width |
| designHeight | number | 1080 | Inner FitScreen design canvas height |
| mode | "fit" | "cover" | "stretch" | "fit" | Inner FitScreen scaling mode |
| transition | "none" | "fade" | "slide" | "zoom" | "cube" | "fade" | Slide transition effect (automatically respects prefers-reduced-motion) |
| overview | boolean | — | Controlled overview grid visibility |
| defaultOverview | boolean | false | Uncontrolled initial overview grid state |
| keyboard | boolean | true | Enable keyboard navigation (ArrowLeft, ArrowRight, Space, Home, End, F, G, Esc) |
| wheel | boolean | false | Enable throttled mouse wheel navigation |
| swipe | boolean | true | Enable touch horizontal swipe navigation |
| loop | boolean | false | Loop back to the first slide when advancing past the last |
| controls | boolean | true | Show the auto-hiding floating bottom control bar |
| autoHideControlsMs | number | 3000 | Milliseconds of pointer inactivity before hiding controls (0 keeps them visible) |
| channelName | string | — | Optional BroadcastChannel channel name for bidirectional sync with PresenterView |
| background | string | — | Stage background color (defaults to the theme background token) |
| apiRef | MutableRefObject<SlideDeckApi | null> | — | Imperative handle (next, prev, goTo, toggleOverview, enterFullscreen, exitFullscreen, toggleFullscreen) |
| labels | Partial<SlideDeckLabels> | — | Override built-in accessible labels and control bar copy |
| className | string | — | Outer container class name |
SlideDeckItem
| Name | Type | Default | Description |
|---|---|---|---|
| id | string | Index | Optional unique slide identifier |
| title | string | — | Slide title displayed in overview thumbnails and aria labels |
| content* | ReactNode | ((ctx: SlideDeckRenderContext) => ReactNode) | — | Slide content or render callback |
| stepsCount | number | 0 | Number of incremental fragment steps on this slide |
| notes | string | — | Optional speaker notes shared directly with PresenterView |
| background | string | — | Optional per-slide background override |
SlideFragmentProps
| Name | Type | Default | Description |
|---|---|---|---|
| step* | number | — | Reveal step threshold (1-based; visible when slide step >= props.step) |
| mode | "fade" | "fade-up" | "none" | "fade" | Reveal transition style |
| children* | ReactNode | — | Content revealed incrementally |
| className | string | — | Additional class name |
Events
| Event | Type | Description |
|---|---|---|
| onIndexChange | (index: number) => void | Called when the active slide index changes |
| onStepChange | (step: number) => void | Called when the active fragment step changes |
| onOverviewChange | (open: boolean) => void | Called when overview grid mode toggles |
Slots
| Slot | Type | Description |
|---|---|---|
| controlsExtra | ReactNode | Extra right-hand slot inside the floating control bar (e.g., presenter mode or draw toggle) |
| overlay | ReactNode | Full-stage overlay slot mounted above the active slide (e.g., <StageDraw />) |
Example
<div className="aspect-video w-full overflow-hidden rounded border border-border">
<SlideDeck
slides={[
{ id: "s1", title: "Cover", content: <CoverSlide /> },
{
id: "s2",
title: "Highlights",
stepsCount: 2,
content: (
<div className="p-20">
<SlideFragment step={1}>First highlight</SlideFragment>
<SlideFragment step={2} mode="fade-up">Second highlight</SlideFragment>
</div>
),
},
]}
channelName="q4-keynote"
transition="slide"
overlay={<StageDraw tool={tool} />}
/>
</div>Pitfalls
- Give the outer container explicit dimensions (such as
h-screen w-screenoraspect-video) soFitScreencan compute its scale factor. - Keyboard shortcuts yield automatically when focus is inside an
input,textarea,select, orcontenteditableelement. - Overview grid thumbnails render with
FitScreen interactive={false}so inner buttons cannot steal focus or block slide jumping.
Related
Playground
Online HTML Enhanced Slide Engine
Aspect Scaling · Fragments · Overview Grid · Dual-Screen Sync
<SlideDeck slides={slides} transition="fade" />