Loading...
Loading...
Master Slidev navigation and keyboard shortcuts. Use this skill for efficient slide control, custom shortcuts, and navigation customization.
npx skill4agent add yoanbernabeu/slidev-skills slidev-navigation| Key | Action |
|---|---|
| Next animation or slide |
| Next animation or slide |
| Previous animation or slide |
| Previous slide (skip animations) |
| Next slide (skip animations) |
| Key | Action |
|---|---|
| Toggle overview mode |
| Toggle dark mode |
| Toggle fullscreen |
| Toggle presenter mode |
| Key | Action |
|---|---|
| Go to specific slide |
| Go to first slide |
| Go to last slide |
| Key | Action |
|---|---|
| Exit fullscreen/overview/drawing |
| Toggle drawing mode |
| Toggle recording |
o/overview| Key | Action |
|---|---|
| Navigate grid |
| Select slide |
| Close overview |
gg → 15 → Entersetup/shortcuts.tsimport { defineShortcutsSetup } from '@slidev/types'
export default defineShortcutsSetup((nav, base) => {
return [
...base, // Keep default shortcuts
{
key: 'enter',
fn: () => nav.next(),
autoRepeat: true,
},
{
key: 'backspace',
fn: () => nav.prev(),
autoRepeat: true,
},
{
key: 'ctrl+f',
fn: () => nav.go(1),
},
]
})| Property | Type | Description |
|---|---|---|
| string | Key combination |
| function | Action to perform |
| boolean | Repeat when held |
// Single key
{ key: 'enter', fn: () => {} }
// Modifier + key
{ key: 'ctrl+s', fn: () => {} }
// Multiple modifiers
{ key: 'ctrl+shift+s', fn: () => {} }ctrlshiftaltmeta<script setup>
import { useNav } from '@slidev/client'
const {
currentSlideNo, // Current slide number (ref)
currentPage, // Current page number
total, // Total slides
clicks, // Current click count
next, // Go to next
prev, // Go to previous
go, // Go to slide number
nextSlide, // Next slide (skip animations)
prevSlide, // Previous slide (skip animations)
} = useNav()
</script><template>
<!-- Custom navigation buttons -->
<button @click="nav.prev()">Previous</button>
<button @click="nav.next()">Next</button>
<button @click="nav.go(1)">Go to Start</button>
<button @click="nav.go(total.value)">Go to End</button>
</template>
<script setup>
import { useNav } from '@slidev/client'
const nav = useNav()
</script><!-- components/ProgressBar.vue -->
<script setup>
import { computed } from 'vue'
import { useNav } from '@slidev/client'
const { currentSlideNo, total } = useNav()
const progress = computed(() =>
(currentSlideNo.value / total.value) * 100
)
</script>
<template>
<div class="fixed top-0 left-0 right-0 h-1 bg-gray-200">
<div
class="h-full bg-blue-500 transition-all"
:style="{ width: `${progress}%` }"
/>
</div>
</template><!-- components/PageNumber.vue -->
<script setup>
import { useNav } from '@slidev/client'
const { currentSlideNo, total } = useNav()
</script>
<template>
<div class="fixed bottom-4 right-4 text-sm">
{{ currentSlideNo }} / {{ total }}
</div>
</template><!-- components/NavButtons.vue -->
<script setup>
import { useNav } from '@slidev/client'
const { prev, next, currentSlideNo, total } = useNav()
</script>
<template>
<div class="fixed bottom-4 flex gap-2">
<button
@click="prev()"
:disabled="currentSlideNo === 1"
class="px-4 py-2 bg-blue-500 text-white rounded disabled:opacity-50"
>
Previous
</button>
<button
@click="next()"
:disabled="currentSlideNo === total"
class="px-4 py-2 bg-blue-500 text-white rounded disabled:opacity-50"
>
Next
</button>
</div>
</template>---
# In frontmatter
---.slidev-page {
pointer-events: none;
}http://localhost:3030/5 # Slide 5
http://localhost:3030/10 # Slide 10http://localhost:3030/presenter
http://localhost:3030/presenter/5 # Presenter at slide 5http://localhost:3030/overview---
routeAlias: introduction
---http://localhost:3030/introduction[Go to Introduction](/introduction)<script setup>
import { watch } from 'vue'
import { useNav } from '@slidev/client'
const { currentSlideNo } = useNav()
watch(currentSlideNo, (newSlide, oldSlide) => {
console.log(`Navigated from ${oldSlide} to ${newSlide}`)
})
</script>Space→←og// If you prefer Enter/Backspace
{
key: 'enter',
fn: () => nav.next(),
}.slidev-nav {
display: none;
}// setup/shortcuts.ts
import { defineShortcutsSetup } from '@slidev/types'
export default defineShortcutsSetup((nav, base) => {
return [
...base, // Keep defaults
// Custom shortcuts
{ key: '[key]', fn: () => nav.[action]() },
]
})