Vue Global Context

Slidev injected a global Vue context $slidev for advanced conditions or navigation controls.


You can access it anywhere in your markdown and Vue template, with the "Mustache" syntax.

<!-- -->

# Page 1

Current page is: {{ $slidev.nav.currentPage }}
<!-- Foo.vue -->

  <div>Title: {{ $slidev.configs.title }}</div>
  <button @click="$">Next Page</button>



$clicks hold a number of clicks on the current slide. Can be used conditionally to show different content on clicks.

<div v-if="$clicks > 3">Content</div>


$page holds the number of the current page, 1-indexed.

Page: {{ $page }}

Is current page active: {{ $page === $slidev.nav.currentPage }}


$renderContext holds the current render context, can be slide, overview, presenter or previewNext

<div v-if="$renderContext === 'slide'">
  This content will only be rendered in slides view


A reactive object holding the properties and controls of the slides navigation. For examples:

$ // go next step

$slidev.nav.nextSlide() // go next slide (skip v-clicks)

$slidev.nav.go(10) // go slide #10
$slidev.nav.currentPage // current slide number

$slidev.nav.currentLayout // current layout id

For more properties available, refer to the nav.ts exports.

Note: $slidev.nav.clicks is a global state while $clicks is local to each slide. It's recommended to use $clicks over $slidev.nav.clicks to avoid clicks changed been triggered on page transitions.


A reactive object holding the parsed configurations in the first frontmatter of your For example

title: My First Slidev!
{{ $slidev.configs.title }} // 'My First Slidev!'


A reactive object holding the parsed theme configurations.

title: My First Slidev!
  primary: #213435
{{ $slidev.themeConfigs.primary }} // '#213435'

Available since v0.43.0

A shorthand of $slidev.nav.