Slidev
Installationπ
Create a new projectπ
# Recommended with pnpm
pnpm create slidev
# Alternatives
npm init slidev@latest
yarn create slidev
bun create slidevPrerequisitesπ
- Node.js >= 18.0
Basic commandsπ
slidev # Start development server
slidev export # Export to PDF/PPTX/PNG
slidev build # Build static web application
slidev format # Format slides
slidev --help # Show helpBasic structureπ
slides.md fileπ
---
theme: seriph
title: My presentation
background: /background.jpg
---
# Presentation title
Subtitle or description
---
# Second slide
Slide contentSlide separationπ
---
# New slide with triple dash separator
---
# Another slideFrontmatterπ
Global configuration (first slide)π
---
theme: default # Theme
background: /cover.jpg # Background image
class: text-center # CSS classes
highlighter: shiki # Syntax highlighter
lineNumbers: false # Line numbering
info: | # Metadata
## My presentation
Additional information
drawings:
persist: false # Drawing persistence
transition: slide-left # Slide transitions
title: Title # Presentation title
mdc: true # Enable MDC syntax
---Per-slide configurationπ
---
layout: center # Slide layout
background: /image.jpg # Specific background
class: text-white # CSS classes
transition: fade # Specific transition
clicks: 3 # Number of clicks
---Built-in layoutsπ
Layout centerπ
---
layout: center
---
# Centered content
Text in the center of the screenLayout cover (cover page)π
---
layout: cover
background: /cover.jpg
---
# Main title
Presentation descriptionLayout two-cols (two columns)π
---
layout: two-cols
---
# Left column
Left content
::right::
# Right column
Right contentLayout image-left / image-rightπ
---
layout: image-left
image: /path/to/image.jpg
---
# Content on the right
Image displays on the left---
layout: image-right
image: /path/to/image.jpg
---
# Content on the left
Image displays on the rightLayout quoteπ
---
layout: quote
---
# "Important quote"
β AuthorLayout sectionπ
---
layout: section
---
# New section
Marks the beginning of a new sectionLayout factπ
---
layout: fact
---
# 1,000,000+
Active usersLayout iframe-left / iframe-rightπ
---
layout: iframe-right
url: https://example.com
---
# Embed a website
Iframe displays on the rightLayout statementπ
---
layout: statement
---
# Important statement
Key message of the presentationLayout defaultπ
---
layout: default
---
# Default layout
Standard contentLayout fullπ
---
layout: full
---
# Full screen
Uses all available spaceLayout noneπ
---
layout: none
---
No style appliedLayout introπ
---
layout: intro
---
# Introduction title
## Author
DescriptionLayout endπ
---
layout: end
---
# Thank you!
Questions?Code blocksπ
Basic code with syntax highlightingπ
β```python
def hello():
print("Hello Slidev!")
β```Code with line highlightingπ
β```python {2-3}
def hello():
print("Hello Slidev!") # Highlighted line
print("Line 3") # Highlighted line
print("Line 4")
β```Code with multiple highlighting stepsπ
β```python {2|3|all}
def hello():
print("Step 1") # Displayed on 1st click
print("Step 2") # Displayed on 2nd click
# 'all' displays everything on 3rd click
β```Monaco editor (interactive code)π
β```ts {monaco}
console.log('Editable code!')
β```Monaco editor with executionπ
β```ts {monaco-run}
console.log('Executable code')
β```Animationsπ
v-click (show on click)π
<v-click>
Appears on first click
</v-click>
<v-click>
Appears on second click
</v-click>v-after (show after previous)π
<v-click>Element 1</v-click>
<v-after>Element 2 (appears right after)</v-after>v-click with hidingπ
<v-click :hide="true">
This element disappears on click
</v-click>v-clicks (animate a list)π
<v-clicks>
- Item 1 (click 1)
- Item 2 (click 2)
- Item 3 (click 3)
</v-clicks>v-clicks with depthπ
<v-clicks depth="2">
- Level 1 (click 1)
- Level 2 (click 2)
- Level 2 (click 3)
</v-clicks>v-click on inline elementπ
Normal text <span v-click>appearing text</span> normal textv-click with precise timingπ
<div v-click="1">Appears on click 1</div>
<div v-click="3">Appears on click 3</div>
<div v-click="2">Appears on click 2</div>v-click with rangeπ
<div v-click="[2, 4]">
Visible between clicks 2 and 4
</div>Motion animations (v-motion)π
Basic animationπ
<div
v-motion
:initial="{ x: -80 }"
:enter="{ x: 0 }">
Slide from the left
</div>Complete animation with clicksπ
<div
v-motion
:initial="{ x: -80, opacity: 0 }"
:enter="{ x: 0, opacity: 1, transition: { delay: 100 } }"
:click-1="{ x: 80 }"
:click-2="{ y: -50, opacity: 0 }"
:leave="{ x: 1000 }">
Complex animation
</div>Available animation propertiesπ
<div
v-motion
:initial="{
x: 0, # X position
y: 0, # Y position
scale: 1, # Scale
rotate: 0, # Rotation (degrees)
opacity: 1 # Opacity
}"
:enter="{
x: 100,
transition: {
duration: 500, # Duration in ms
delay: 100, # Delay in ms
ease: 'easeOut' # Easing type
}
}">
Animated element
</div>Slide transitionsπ
Global transitionsπ
---
transition: slide-left # fade, slide-left, slide-right, slide-up, slide-down
---Per-slide transitionsπ
---
transition: fade
---Custom transitions (forward/backward)π
---
transition: slide-left|slide-right # slide-left forward, slide-right backward
---Built-in componentsπ
Arrowπ
<Arrow x1="10" y1="20" x2="100" y2="200" />AutoFitText (adaptive text)π
<AutoFitText :max="200" :min="100" modelValue="Large text" />LightOrDark (light/dark theme conditional)π
<LightOrDark>
<template #dark>Dark mode content</template>
<template #light>Light mode content</template>
</LightOrDark>Linkπ
<Link to="5">Go to slide 5</Link>
<Link to="5" title="Link title" />RenderWhen (conditional rendering)π
<RenderWhen context="main">
Displayed only in main presentation
</RenderWhen>
<RenderWhen context="presenter">
Displayed only in presenter mode
</RenderWhen>SlideCurrentNo (slide number)π
Slide <SlideCurrentNo /> / <SlidesTotal />Toc / TocList (table of contents)π
<Toc />
# Or with options
<TocList maxDepth="2" minDepth="1" />Transformπ
<Transform :scale="0.5">
<YourElements />
</Transform>
<Transform :rotate="45" origin="top left">
Rotated element
</Transform>Tweet (embed tweet)π
<Tweet id="1234567890" />VueSlideCore (custom Vue slide)π
<VueSlideCore :page="5" />Youtube (YouTube video)π
<Youtube id="dQw4w9WgXcQ" width="100%" height="400px" />Presenter notesπ
---
layout: center
---
# My slide
Visible content
<!--
This is a presenter note
Visible only in presenter mode
-->Mathematical formulas (LaTeX)π
Inlineπ
Inline formula: $E = mc^2$Blockπ
$$
\frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x)
$$Diagramsπ
Mermaidπ
β```mermaid
graph TD
A[Start] --> B[Process]
B --> C[End]
β```PlantUMLπ
β```plantuml
@startuml
Alice -> Bob: Hello
Bob -> Alice: Hi!
@enduml
β```Style and CSSπ
Global CSS classesπ
---
class: text-center text-2xl
---Slide-scoped CSSπ
---
layout: center
---
# My slide
<style>
h1 {
color: red;
}
</style>UnoCSS classesπ
<div class="text-3xl text-blue-500 font-bold">
Text styled with UnoCSS
</div>MDC syntax (Markdown Components)π
Add classes and attributesπ
# Title
[Link]
Components with propsπ
::component-name{prop1="value" prop2="value"}
Content
::Iconsπ
With UnoCSSπ
<div class="i-carbon-logo-github" />
<div class="i-mdi-account text-3xl text-red-500" />Backgroundsπ
Background imageπ
---
background: /path/to/image.jpg
---Background colorπ
---
background: '#1e1e1e'
---Gradientπ
---
background: linear-gradient(to right, #ff0000, #0000ff)
---Video backgroundπ
---
background: /video.mp4
---Import external slidesπ
Import a fileπ
---
src: ./external-slides.md
---Import a range of slidesπ
---
src: ./external-slides.md
pages: 1-5
---Presenter modeπ
- Press
?to see all keyboard shortcuts - Presenter notes visible only in presentation mode
- Next slide preview
- Timer and clock
Essential keyboard shortcutsπ
| Key | Action |
|---|---|
Space / β | Next slide |
β | Previous slide |
β | Previous slide (no animations) |
β | Next slide (no animations) |
Home | First slide |
End | Last slide |
f | Fullscreen |
o | Overview |
d | Dark mode |
g | Show/hide camera |
r | Recording |
e | Drawing mode |
c | Presenter notes |
? | Show all shortcuts |
Exportπ
PDFπ
slidev export
# With options
slidev export --format pdf --output slides.pdfPNGπ
slidev export --format pngPPTXπ
slidev export --format pptxExport optionsπ
slidev export --dark # Dark mode
slidev export --with-clicks # Include animations
slidev export --timeout 30000 # Render timeoutBuild for productionπ
slidev build
# With base path
slidev build --base /slides/Hostingπ
Built slides can be hosted on any static server:
- GitHub Pages
- Netlify
- Vercel
- Custom server
Advanced configurationπ
vite.config.ts fileπ
import { defineConfig } from 'vite'
export default defineConfig({
slidev: {
// Slidev options
}
})Custom themesπ
---
theme: ./custom-theme
---Addonsπ
Install addons via npm and configure them in frontmatter:
---
addons:
- slidev-addon-example
---Tipsπ
Disable animationsπ
---
clicks: 0 # No clicks on this slide
---Aspect ratioπ
---
aspectRatio: '16/9' # or '4/3'
---Global line numberingπ
---
lineNumbers: true
---Custom faviconπ
Place public/favicon.ico in the project
Custom fontsπ
---
fonts:
sans: 'Robot'
serif: 'Robot Slab'
mono: 'Fira Code'
---Resourcesπ
- Official documentation: https://sli.dev
- GitHub: https://github.com/slidevjs/slidev
- Themes: https://sli.dev/themes/gallery.html
- Addons: https://sli.dev/addons/use.html