Prerequisites
Before installing nextjs-slides, ensure your project meets these requirements:- Next.js >= 15.0.0
- React >= 19.0.0
- React DOM >= 19.0.0
- Tailwind CSS >= 4.0.0
This library requires React 19 for ViewTransitions and Tailwind CSS v4 for the
@source directive that enables automatic utility class scanning.Install the Package
Install nextjs-slides using your preferred package manager:Peer Dependencies
If you don’t already have the peer dependencies installed, add them to your project:The package also includes
clsx, tailwind-merge, and highlight.js as direct dependencies, so you don’t need to install them separately.Import the Stylesheet
Add the nextjs-slides stylesheet to your root layout or global CSS file. This must come after the Tailwind CSS import:globals.css
What’s Included
Thenextjs-slides/styles.css file provides:
- Syntax highlighting theme — CSS variables for code blocks (
--nxs-code-*and--sh-*) - Slide transition animations —
::view-transition-*animations for smooth slide changes - Tailwind source directive — Automatic utility class scanning for the library
Verify Installation
To verify everything is set up correctly, check that:- The stylesheet is imported in your global CSS after Tailwind
- Your project is using Next.js 15+, React 19+, and Tailwind CSS 4+
- You can import components from the package:
Optional: Geist Fonts
For the best visual experience, you can optionally install the Geist font family:app/layout.tsx
globals.css
className="font-pixel" on any primitive where you want the pixel display font.
Troubleshooting
Slide utility classes not applying
Slide utility classes not applying
Make sure Adjust the path to be relative to your CSS file location.
nextjs-slides/styles.css is imported after tailwindcss in your global CSS. If styles still don’t apply, you can manually add the source directive:globals.css
Syntax highlighting looks broken
Syntax highlighting looks broken
Ensure you’ve imported
nextjs-slides/styles.css in your root layout or global CSS. The --sh-* variables must be in scope for highlight.js tokens to display correctly.Split layout not stacking on mobile
Split layout not stacking on mobile
Import the stylesheet without a layer:Not:Layered imports can be overridden by Tailwind utilities.
Next Steps
Now that nextjs-slides is installed, you’re ready to create your first slide deck:Quick Start
Follow the step-by-step guide to build your first presentation