Make sure you’ve installed nextjs-slides before starting this guide.
Step-by-Step Guide
Import the stylesheet
In your root layout or global CSS file, import the nextjs-slides stylesheet after Tailwind CSS:The stylesheet includes an
app/globals.css
@source directive that tells Tailwind v4 to scan the library’s component files for utility classes — no extra configuration needed.Define your slides
Create a file to define your slides. Import the primitives you need and build your slide array:Each slide is a React element with a unique
app/slides/slides.tsx
key. The align prop controls content alignment ("center" or "left").Create the layout (provider)
Create a layout file that wraps your slides with the
SlideDeck provider:app/slides/layout.tsx
SlideDeck is a client component, so your layout can stay a server component — no "use client" needed.Add the index route
Create a page that redirects to the first slide:This ensures
app/slides/page.tsx
/slides automatically redirects to /slides/1.Add the dynamic slide route
Create a dynamic route to render individual slides:
app/slides/[page]/page.tsx
generateSlideParams() generates static params for all slides (1, 2, 3, etc.), and getSlide() renders the correct slide based on the URL parameter.Try It Out
Your slide deck is now ready! Here’s what you can do:- Navigate with keyboard: Press
→orSpaceto go to the next slide,←to go back - URL-based routing: Each slide has its own URL (e.g.,
/slides/1,/slides/2) - Progress indicators: See the dot progress indicator and slide counter at the bottom
Folder Structure
Here’s the complete folder structure for your slide deck:Next Steps
Components
Explore all available components for building slides
SlideDeck API
Customize your slide deck with props and configuration
Keyboard Navigation
Learn about keyboard shortcuts and navigation
Speaker Notes
Add speaker notes and sync them to your phone
Add More Slides
To add more slides, simply add more elements to theslides array:
app/slides/slides.tsx
Customization
You can customize your slide deck with additional props:app/slides/layout.tsx
basePath— URL prefix for slide routes (default:"/slides")exitUrl— URL for the exit button (×) in the top-right cornershowProgress— Show dot progress indicator (default:true)showCounter— Show slide counter like “3 / 10” (default:true)
Learn More
View Full Documentation
Explore all components, features, and configuration options