v1.3.0
  1. ds
  2. Components
  3. Skeleton

Skeleton

Placeholder while content loads.

Code
<div aria-busy="true" aria-label="Loading post" style="max-width:32rem">
  <span class="skeleton title"></span>
  <span class="skeleton"></span>
  <span class="skeleton" style="width:85%"></span>
  <span class="skeleton block"></span>
</div>

Only for content that takes longer than about 300 ms and has a known shape. A slow shimmer, no colour. Static pages never need one.

ClassOnWhat it does
.skeletonspanA text line.
.title / .block.skeletonA heading line, or a 6rem block for a figure or image.
.row.skeletonExactly one 24px row: a 12px bar with 6px above and below. Stack them where dense rows will land.

Rows

Code
<div aria-busy="true" style="max-width:20rem">
  <span class="skeleton row"></span>
  <span class="skeleton row" style="width:82%"></span>
  <span class="skeleton row" style="width:64%"></span>
</div>

.skeleton.row takes the height of a dense row, so a list that loads into it does not move. Use it in panes and sidebars instead of a spinner.

Accessibility

  • Put aria-busy="true" on the container and remove it when content arrives.