| 1 | # Layouts |
| 2 | |
| 3 | This page lists all the built-in layouts provided by Slidev. These layouts can be used via the `layout` option in the frontmatters of your slides. |
| 4 | |
| 5 | Note that <LinkInline link="guide/theme-addon" /> may provide additional layouts or override the existing ones. To add your own layouts, see <LinkInline link="guide/write-layout" />. |
| 6 | |
| 7 | ## `center` |
| 8 | |
| 9 | Displays the content in the middle of the screen. |
| 10 | |
| 11 | ## `cover` |
| 12 | |
| 13 | Used to display the cover page for the presentation, may contain the presentation title, contextualization, etc. |
| 14 | |
| 15 | ## `default` |
| 16 | |
| 17 | The most basic layout, to display any kind of content. |
| 18 | |
| 19 | ## `end` |
| 20 | |
| 21 | The final page for the presentation. |
| 22 | |
| 23 | ## `fact` |
| 24 | |
| 25 | To show some fact or data with a lot of prominence on the screen. |
| 26 | |
| 27 | ## `full` |
| 28 | |
| 29 | Use all the space of the screen to display the content. |
| 30 | |
| 31 | ## `image-left` |
| 32 | |
| 33 | Shows an image on the left side of the screen, the content will be placed on the right side. |
| 34 | |
| 35 | ### Usage |
| 36 | |
| 37 | ```yaml |
| 38 | --- |
| 39 | layout: image-left |
| 40 | |
| 41 | # the image source |
| 42 | image: /path/to/the/image |
| 43 | |
| 44 | # a custom class name to the content |
| 45 | class: my-cool-content-on-the-right |
| 46 | --- |
| 47 | ``` |
| 48 | |
| 49 | ## `image-right` |
| 50 | |
| 51 | Shows an image on the right side of the screen, the content will be placed on the left side. |
| 52 | |
| 53 | ### Usage |
| 54 | |
| 55 | ```yaml |
| 56 | --- |
| 57 | layout: image-right |
| 58 | |
| 59 | # the image source |
| 60 | image: /path/to/the/image |
| 61 | |
| 62 | # a custom class name to the content |
| 63 | class: my-cool-content-on-the-left |
| 64 | --- |
| 65 | ``` |
| 66 | |
| 67 | ## `image` |
| 68 | |
| 69 | Shows an image as the main content of the page. |
| 70 | |
| 71 | ### Usage |
| 72 | |
| 73 | ```yaml |
| 74 | --- |
| 75 | layout: image |
| 76 | |
| 77 | # the image source |
| 78 | image: /path/to/the/image |
| 79 | --- |
| 80 | ``` |
| 81 | |
| 82 | You can change the default background size (`cover`) by adding the `backgroundSize` attribute: |
| 83 | |
| 84 | ```yaml |
| 85 | --- |
| 86 | layout: image |
| 87 | image: /path/to/the/image |
| 88 | backgroundSize: contain |
| 89 | --- |
| 90 | ``` |
| 91 | |
| 92 | ```yaml |
| 93 | --- |
| 94 | layout: image-left |
| 95 | image: /path/to/the/image |
| 96 | backgroundSize: 20em 70% |
| 97 | --- |
| 98 | ``` |
| 99 | |
| 100 | ## `iframe-left` |
| 101 | |
| 102 | Shows a web page on the left side of the screen, the content will be placed on the right side. |
| 103 | |
| 104 | ### Usage |
| 105 | |
| 106 | ```yaml |
| 107 | --- |
| 108 | layout: iframe-left |
| 109 | |
| 110 | # the web page source |
| 111 | url: https://github.com/slidevjs/slidev |
| 112 | |
| 113 | # a custom class name to the content |
| 114 | class: my-cool-content-on-the-right |
| 115 | --- |
| 116 | ``` |
| 117 | |
| 118 | ## `iframe-right` |
| 119 | |
| 120 | Shows a web page on the right side of the screen, the content will be placed on the left side. |
| 121 | |
| 122 | ### Usage |
| 123 | |
| 124 | ```yaml |
| 125 | --- |
| 126 | layout: iframe-right |
| 127 | |
| 128 | # the web page source |
| 129 | url: https://github.com/slidevjs/slidev |
| 130 | |
| 131 | # a custom class name to the content |
| 132 | class: my-cool-content-on-the-left |
| 133 | --- |
| 134 | ``` |
| 135 | |
| 136 | ## `iframe` |
| 137 | |
| 138 | Shows a web page as the main content of the page. |
| 139 | |
| 140 | ### Usage |
| 141 | |
| 142 | ```yaml |
| 143 | --- |
| 144 | layout: iframe |
| 145 | |
| 146 | # the web page source |
| 147 | url: https://github.com/slidevjs/slidev |
| 148 | --- |
| 149 | ``` |
| 150 | |
| 151 | ## `intro` |
| 152 | |
| 153 | To introduce the presentation, usually with the presentation title, a short description, the author, etc. |
| 154 | |
| 155 | ## `none` |
| 156 | |
| 157 | A layout without any existing styling. |
| 158 | |
| 159 | ## `quote` |
| 160 | |
| 161 | To display a quotation with prominence. |
| 162 | |
| 163 | ## `section` |
| 164 | |
| 165 | Used to mark the beginning of a new presentation section. |
| 166 | |
| 167 | ## `statement` |
| 168 | |
| 169 | Make an affirmation/statement as the main page content. |
| 170 | |
| 171 | ## `two-cols` |
| 172 | |
| 173 | Separates the page content in two columns. |
| 174 | |
| 175 | ### Usage |
| 176 | |
| 177 | ```md |
| 178 | --- |
| 179 | layout: two-cols |
| 180 | --- |
| 181 | |
| 182 | # Left |
| 183 | |
| 184 | This shows on the left |
| 185 | |
| 186 | ::right:: |
| 187 | |
| 188 | # Right |
| 189 | |
| 190 | This shows on the right |
| 191 | ``` |
| 192 | |
| 193 | ## `two-cols-header` |
| 194 | |
| 195 | Separates the upper and lower lines of the page content, and the second line separates the left and right columns. |
| 196 | |
| 197 | ### Usage |
| 198 | |
| 199 | ```md |
| 200 | --- |
| 201 | layout: two-cols-header |
| 202 | --- |
| 203 | |
| 204 | This spans both |
| 205 | |
| 206 | ::left:: |
| 207 | |
| 208 | # Left |
| 209 | |
| 210 | This shows on the left |
| 211 | |
| 212 | ::right:: |
| 213 | |
| 214 | # Right |
| 215 | |
| 216 | This shows on the right |
| 217 | |
| 218 | <style> |
| 219 | .two-cols-header { |
| 220 | column-gap: 20px; /* Adjust the gap size as needed */ |
| 221 | } |
| 222 | </style> |
| 223 | ``` |
| 224 |