placeholder.mdx 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. ---
  2. title: Placeholder
  3. description: Placeholder is used to reserve space for content that soon will appear in a layout.
  4. redirect_from:
  5. - /docs/skeleton.html
  6. ---
  7. ## Placeholder line
  8. Placeholder lines can contain have lines of text. Their length is different and depends on the `col-` class.
  9. ```html code example columns={1}
  10. <div class="placeholder col-9"></div>
  11. <div class="placeholder col-11"></div>
  12. <div class="placeholder col-10"></div>
  13. <div class="placeholder col-8"></div>
  14. ```
  15. However, it may be useful, however, to specify the full width in order to fit the content more effectively.
  16. ```html code example columns={1}
  17. <div class="placeholder col-12"></div>
  18. <div class="placeholder col-12"></div>
  19. <div class="placeholder col-12"></div>
  20. <div class="placeholder col-12"></div>
  21. ```
  22. You can also move the lines to right or to center:
  23. ```html code example columns={1}
  24. <div class="text-end">
  25. <div class="placeholder col-11"></div>
  26. <div class="placeholder col-10"></div>
  27. <div class="placeholder col-8"></div>
  28. </div>
  29. <div class="text-center mt-3">
  30. <div class="placeholder col-11"></div>
  31. <div class="placeholder col-10"></div>
  32. <div class="placeholder col-8"></div>
  33. </div>
  34. ```
  35. ## Placeholder heading
  36. A placeholder can contain also a header element looks like header:
  37. ```html code example columns={1}
  38. <div class="placeholder col-9 mb-3"></div>
  39. <div class="placeholder placeholder-xs col-10"></div>
  40. <div class="placeholder placeholder-xs col-11"></div>
  41. ```
  42. ## Placeholder avatar
  43. You can make your placeholder item look like an avatar.
  44. ```html code example columns={1}
  45. <div class="row">
  46. <div class="col-auto">
  47. <div class="avatar placeholder"></div>
  48. </div>
  49. <div class="col">
  50. <div class="placeholder col-9"></div>
  51. <div class="placeholder col-11"></div>
  52. </div>
  53. </div>
  54. ```
  55. The size of avatars is exactly the same as a regular avatar.
  56. ```html code example centered separated
  57. <div class="avatar avatar-xl placeholder"></div>
  58. <div class="avatar avatar-lg placeholder"></div>
  59. <div class="avatar avatar-md placeholder"></div>
  60. <div class="avatar placeholder"></div>
  61. <div class="avatar avatar-sm placeholder"></div>
  62. <div class="avatar avatar-xs placeholder"></div>
  63. ```
  64. ## Placeholder image
  65. You can use a placeholder, which will look like a picture. You can use the `ratio` component, and get the image in the right proportions.
  66. You can also use the `ratio` component, and get the image in the right proportions.
  67. ```html code example columns={1}
  68. <div class="ratio ratio-1x1 placeholder">
  69. <div class="placeholder-image"></div>
  70. </div>
  71. <div class="ratio ratio-4x3 placeholder">
  72. <div class="placeholder-image"></div>
  73. </div>
  74. <div class="ratio ratio-16x9 placeholder">
  75. <div class="placeholder-image"></div>
  76. </div>
  77. <div class="ratio ratio-21x9 placeholder">
  78. <div class="placeholder-image"></div>
  79. </div>
  80. ```
  81. ## Placeholder color
  82. By default, the `placeholder` uses `currentColor`. This can be overridden with a custom color or utility class.
  83. ```html example columns={1}
  84. <span class="placeholder col-12"></span>
  85. <span class="placeholder col-12 bg-primary"></span>
  86. <span class="placeholder col-12 bg-secondary"></span>
  87. <span class="placeholder col-12 bg-success"></span>
  88. <span class="placeholder col-12 bg-danger"></span>
  89. <span class="placeholder col-12 bg-warning"></span>
  90. <span class="placeholder col-12 bg-info"></span>
  91. <span class="placeholder col-12 bg-light"></span>
  92. <span class="placeholder col-12 bg-dark"></span>
  93. ```
  94. ```html
  95. <span class="placeholder col-12"></span>
  96. <span class="placeholder col-12 bg-primary"></span>
  97. <span class="placeholder col-12 bg-secondary"></span>
  98. <span class="placeholder col-12 bg-success"></span>
  99. <span class="placeholder col-12 bg-danger"></span>
  100. <span class="placeholder col-12 bg-warning"></span>
  101. <span class="placeholder col-12 bg-info"></span>
  102. <span class="placeholder col-12 bg-light"></span>
  103. <span class="placeholder col-12 bg-dark"></span>
  104. ```
  105. ## Placeholder sizing
  106. The size of `.placeholders` are based on the typographic style of the parent element. Customize them with sizing modifiers: `.placeholder-lg`, `.placeholder-sm`, or `.placeholder-xs`.
  107. ```html code example columns={1}
  108. <span class="placeholder col-12 placeholder-lg"></span>
  109. <span class="placeholder col-12"></span>
  110. <span class="placeholder col-12 placeholder-sm"></span>
  111. <span class="placeholder col-12 placeholder-xs"></span>
  112. ```
  113. ## Animation
  114. Animate placeholders with `.placeholder-glow` or `.placeholder-wave` to better convey the perception of something being actively loaded.
  115. ```html code example columns={1}
  116. <p class="placeholder-glow">
  117. <span class="placeholder col-12"></span>
  118. </p>
  119. <p class="placeholder-wave">
  120. <span class="placeholder col-12"></span>
  121. </p>
  122. ```
  123. ## Live examples
  124. See in the following examples how else you can use the placeholder component
  125. ```html code example columns={1} height={1000} separated vertical
  126. <div class="card placeholder-glow">
  127. <div class="ratio ratio-21x9 card-img-top placeholder"></div>
  128. <div class="card-body">
  129. <div class="placeholder col-9 mb-3"></div>
  130. <div class="placeholder placeholder-xs col-10"></div>
  131. <div class="placeholder placeholder-xs col-11"></div>
  132. <div class="mt-3">
  133. <a href="#" tabindex="-1" class="btn btn-primary disabled placeholder col-4" aria-hidden="true"></a>
  134. </div>
  135. </div>
  136. </div>
  137. <div class="card">
  138. <div class="row g-0 align-items-center placeholder-glow">
  139. <div class="col-3">
  140. <div class="ratio ratio-1x1 card-img-start placeholder"></div>
  141. </div>
  142. <div class="col">
  143. <div class="card-body">
  144. <div class="placeholder col-9 mb-3"></div>
  145. <div class="placeholder placeholder-xs col-10"></div>
  146. <div class="placeholder placeholder-xs col-11"></div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="card">
  152. <div class="card-body">
  153. <div class="row">
  154. <div class="col-auto">
  155. <div class="avatar avatar-rounded placeholder"></div>
  156. </div>
  157. <div class="col">
  158. <div class="placeholder placeholder-xs col-9"></div>
  159. <div class="placeholder placeholder-xs col-7"></div>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. <div class="card">
  165. <div class="card-body py-5 text-center">
  166. <div>
  167. <div class="avatar avatar-rounded avatar-lg placeholder mb-3"></div>
  168. </div>
  169. <div class="mt w-75 mx-auto">
  170. <div class="placeholder col-9 mb-3"></div>
  171. <div class="placeholder placeholder-xs col-10"></div>
  172. </div>
  173. </div>
  174. </div>
  175. <div class="card">
  176. <ul class="list-group list-group-flush placeholder-glow">
  177. <li class="list-group-item">
  178. <div class="row align-items-center">
  179. <div class="col-auto">
  180. <div class="avatar avatar-rounded placeholder"></div>
  181. </div>
  182. <div class="col-7">
  183. <div class="placeholder placeholder-xs col-9"></div>
  184. <div class="placeholder placeholder-xs col-7"></div>
  185. </div>
  186. <div class="col-2 ms-auto text-end">
  187. <div class="placeholder placeholder-xs col-8"></div>
  188. <div class="placeholder placeholder-xs col-10"></div>
  189. </div>
  190. </div>
  191. </li>
  192. <li class="list-group-item">
  193. <div class="row align-items-center">
  194. <div class="col-auto">
  195. <div class="avatar avatar-rounded placeholder"></div>
  196. </div>
  197. <div class="col-7">
  198. <div class="placeholder placeholder-xs col-9"></div>
  199. <div class="placeholder placeholder-xs col-7"></div>
  200. </div>
  201. <div class="col-2 ms-auto text-end">
  202. <div class="placeholder placeholder-xs col-8"></div>
  203. <div class="placeholder placeholder-xs col-10"></div>
  204. </div>
  205. </div>
  206. </li>
  207. <li class="list-group-item">
  208. <div class="row align-items-center">
  209. <div class="col-auto">
  210. <div class="avatar avatar-rounded placeholder"></div>
  211. </div>
  212. <div class="col-7">
  213. <div class="placeholder placeholder-xs col-9"></div>
  214. <div class="placeholder placeholder-xs col-7"></div>
  215. </div>
  216. <div class="col-2 ms-auto text-end">
  217. <div class="placeholder placeholder-xs col-8"></div>
  218. <div class="placeholder placeholder-xs col-10"></div>
  219. </div>
  220. </div>
  221. </li>
  222. <li class="list-group-item">
  223. <div class="row align-items-center">
  224. <div class="col-auto">
  225. <div class="avatar avatar-rounded placeholder"></div>
  226. </div>
  227. <div class="col-7">
  228. <div class="placeholder placeholder-xs col-9"></div>
  229. <div class="placeholder placeholder-xs col-7"></div>
  230. </div>
  231. <div class="col-2 ms-auto text-end">
  232. <div class="placeholder placeholder-xs col-8"></div>
  233. <div class="placeholder placeholder-xs col-10"></div>
  234. </div>
  235. </div>
  236. </li>
  237. </ul>
  238. </div>
  239. ```