Skip to content
Español

Navigate

Type to search. Press Escape to close.

    Components · css

    Skeleton

    Placeholder shapes while content loads. Skeletons are decorative: hide them from assistive technology with aria-hidden="true" and mark the waiting container with aria-busy="true". Replace them with real content; do not leave them in the DOM.

    CSS: css/components/skeleton.css (in ivolt.css).

    A card while it loadsfixtures/skeleton/card.htmlOpen alone — A card while it loads
    <div class="iv-grid iv-u-gap-4 iv-u-grid-cols-1 iv-u-md-grid-cols-2" aria-busy="true">
      <span class="iv-u-sr-only">Loading the release summary</span>
    
      <article class="iv-card">
        <div class="iv-skeleton iv-skeleton--rect" aria-hidden="true"></div>
        <div class="iv-card__body iv-stack iv-u-gap-3">
          <div class="iv-skeleton iv-skeleton--title" aria-hidden="true"></div>
          <div class="iv-skeleton iv-skeleton--text" aria-hidden="true"></div>
          <div class="iv-skeleton iv-skeleton--text" aria-hidden="true" style="inline-size: 80%"></div>
        </div>
      </article>
    
      <article class="iv-card">
        <div class="iv-card__body iv-stack iv-u-gap-3">
          <div class="iv-cluster iv-u-gap-3 iv-u-items-center">
            <div class="iv-skeleton iv-skeleton--circle" aria-hidden="true"></div>
            <div class="iv-stack iv-u-gap-2" style="flex: 1">
              <div class="iv-skeleton iv-skeleton--title" aria-hidden="true"></div>
              <div class="iv-skeleton iv-skeleton--text" aria-hidden="true" style="inline-size: 45%"></div>
            </div>
          </div>
          <div class="iv-skeleton iv-skeleton--text" aria-hidden="true"></div>
          <div class="iv-skeleton iv-skeleton--text" aria-hidden="true"></div>
          <div class="iv-skeleton iv-skeleton--text" aria-hidden="true" style="inline-size: 60%"></div>
        </div>
      </article>
    </div>

    Modifiers

    --text, --title, --circle, --rect. The shimmer uses @keyframes iv-shimmer and is static under prefers-reduced-motion.

    The loading pattern

    A skeleton is only half of the pattern. The container that is waiting says so with aria-busy="true", the shapes are hidden from assistive technology, and when the data arrives you replace the shapes and remove the attribute. Screen readers hear the state, not a list of empty boxes.

    <article class="iv-card" aria-busy="true">
      <div class="iv-card__body iv-stack">
        <span class="iv-skeleton iv-skeleton--title" aria-hidden="true"></span>
        <span class="iv-skeleton iv-skeleton--text" aria-hidden="true"></span>
        <span class="iv-skeleton iv-skeleton--text" aria-hidden="true"></span>
      </div>
    </article>

    Match the shapes to the real content (a circle where the avatar will be, two lines where the text will be) so nothing jumps when it arrives. If loading is quick, do not show a skeleton at all: a flash of grey is worse than a short wait.

    Customising

    Locals: --iv-skeleton-bg, --iv-skeleton-highlight (the sweep, mixed halfway towards the strong border so it shows in both themes) and --iv-skeleton-radius. Under prefers-reduced-motion: reduce the sweep stops and the shapes stay as flat blocks.

    Class index

    Parts and modifiers of this family that the examples above do not show. The full list per stylesheet lives in the reference.

    ClassWhat it does
    iv-skeleton--textLine of text: one line height with the text radius.
    iv-skeleton--titleTaller, shorter line, for a heading.
    iv-skeleton--rectRectangular block: an image, a card.
    iv-skeleton--circleCircle, for an avatar.