You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: builtin/components.md
+43Lines changed: 43 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,49 @@ Parameters:
80
80
81
81
*`no` (`string | number`): The number of the slide to display the title from (slides starts from `1`)
82
82
83
+
### `LightOrDark`
84
+
85
+
Use it to display one thing or another depending on the active light or dark theme.
86
+
87
+
#### Usage
88
+
89
+
Use it with the two named Slots `#dark` and `#light`:
90
+
~~~md
91
+
<LightOrDark>
92
+
<template #dark>Dark mode is on</template>
93
+
<template #light>Light mode is on</template>
94
+
</LightOrDark>
95
+
~~~
96
+
97
+
Provided props on `LightOrDark` component will be available using scoped slot props:
98
+
~~~md
99
+
<LightOrDark width="100" alt="some image">
100
+
<template #dark="props">
101
+
<img src="/dark.png" v-bind="props"/>
102
+
</template>
103
+
<template #light="props">
104
+
<img src="/light.png" v-bind="props"/>
105
+
</template>
106
+
</LightOrDark>
107
+
~~~
108
+
109
+
You can provide markdown in the slots, but you will need to surround the content with blank lines:
110
+
~~~md
111
+
<LightOrDark>
112
+
<template #dark>
113
+
114
+

115
+
116
+
</template>
117
+
<template #light>
118
+
119
+

120
+
121
+
</template>
122
+
</LightOrDark>
123
+
~~~
124
+
125
+
83
126
## Custom Components
84
127
85
128
Create a directory `components/` under your project root, and simply put your custom Vue components under it, then you can use it with the same name in your markdown file!
0 commit comments