Skip to content

Commit 2236db4

Browse files
authored
feat: add LightOrDark component doc (#106)
1 parent a89202a commit 2236db4

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

builtin/components.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,49 @@ Parameters:
8080

8181
* `no` (`string | number`): The number of the slide to display the title from (slides starts from `1`)
8282

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+
![dark](/dark.png)
115+
116+
</template>
117+
<template #light>
118+
119+
![light](/light.png)
120+
121+
</template>
122+
</LightOrDark>
123+
~~~
124+
125+
83126
## Custom Components
84127

85128
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

Comments
 (0)