Skip to content

Configuration

react-slides.config.ts (or .js, .mjs) at the project root. The CLI reads controls, plugins, and viewport from this file when wrapping your slides in <PresentationViewer>.

import { defineConfig } from '@react-slides/cli'
import { keyboard, touch, autoplay } from '@react-slides/viewer'
export default defineConfig({
entry: 'src/slides.tsx',
viewport: { width: 1920, height: 1080 },
controls: [keyboard(), touch()],
plugins: [autoplay(5000)],
vite: {
base: '/my-talk/',
},
export: {
pdf: { format: 'A4', quality: 1 },
},
})

If no config file exists, the CLI prints a warning and falls back to keyboard() + touch() at runtime.

NameTypeDefaultDescription
entry?stringPath to the slides entry file. Auto-detected when omitted.
viewport?{ width: number; height: number }Authoring resolution passed to PresentationViewer.
controls?ControlAdapter[]Navigation adapters (keyboard, touch, hashRouter, etc.).
plugins?Plugin[]Presentation plugins (presenterMode, autoplay, etc.).
vite?Record<string, unknown>Vite config overrides (merged).
export.pdf?{ format?: string; quality?: number }PDF export options.

Programmatic API

Each command is also exported.

import { dev, build, exportPresentation, preview, init, defineConfig } from '@react-slides/cli'
await dev('slides.tsx', { port: 3000, open: true, host: false })
await build('slides.tsx', { out: 'dist', base: '/' })
await exportPresentation('slides.tsx', { format: 'pdf', out: 'slides.pdf' })
await preview('slides.tsx', { port: 4173 })
await init('./my-talk', { template: 'full' })