Skip to content

Skeleton and spinner

What a page or panel shows while it loads, as gray shapes or a turning arc and a word.

<div class="cap-skeleton" aria-busy="true" id="sample-skeleton">
  <span class="cap-sr-only">Loading</span>
  <span class="cap-skeleton-line" aria-hidden="true"></span>
  <span class="cap-skeleton-line" aria-hidden="true"></span>
  <span class="cap-skeleton-line" aria-hidden="true"></span>
</div>

Installation

// package.json: "capsomer": "github:DrDustinEdwards/capsomer#v0.152.2"
import "capsomer/tokens.css";
import "capsomer/base.css";
import "capsomer/skeleton.css";

Usage

<div class="cap-skeleton" aria-busy="true">
  <span class="cap-sr-only">Loading</span>
  <span class="cap-skeleton-line" aria-hidden="true"></span>
  <span class="cap-skeleton-line" aria-hidden="true"></span>
  <span class="cap-skeleton-line" aria-hidden="true"></span>
</div>

<div aria-busy="true">
  <span class="cap-sr-only">Loading the mention</span>
  <span class="cap-skeleton-block" data-shape="circle" aria-hidden="true"></span>
  <span class="cap-skeleton-block" aria-hidden="true"></span>
</div>

<span class="cap-spinner">
  <svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg>
  <span class="cap-spinner-label">Loading</span>
</span>

<main aria-busy="true">
  <span class="cap-spinner" data-layout="page" role="status">[arc]<span class="cap-spinner-label">Loading the Portal</span></span>
</main>

Examples

Shapes: a block, a circle, a card

<div class="skeleton-sample-shapes" aria-busy="true" id="sample-shapes">
  <span class="cap-sr-only">Loading the mention</span>
  <span class="cap-skeleton-block" data-shape="circle" aria-hidden="true"></span>
  <span class="skeleton-sample-stack" aria-hidden="true">
    <span class="cap-skeleton-block"></span>
    <span class="cap-skeleton-line"></span>
  </span>
  <span class="cap-skeleton-block" data-shape="card" aria-hidden="true"></span>
</div>

Spinner, for one panel or inside a button

<div class="cap-specimen-row">
  <span class="cap-spinner" id="sample-spinner"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Loading</span></span>
  <button type="button" class="cap-btn" id="sample-busy"><span class="cap-spinner"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Saving</span></span></button>
  <button type="button" class="cap-btn" data-variant="primary"><span class="cap-spinner" data-label="hidden"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Saving</span></span></button>
</div>

Sizes

<div class="cap-specimen-row" id="sample-sizes">
  <span class="cap-spinner" data-size="sm"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Small</span></span>
  <span class="cap-spinner"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Default</span></span>
  <span class="cap-spinner" data-size="lg"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Large</span></span>
</div>

The word for screen readers only

<div class="cap-specimen-row">
  <span class="cap-spinner" data-label="hidden" id="sample-hidden-label"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Refreshing the queue</span></span>
</div>

Comfortable density

<div class="cap-specimen-row" data-density="comfortable" id="sample-comfortable">
  <span class="cap-spinner"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Loading</span></span>
  <span class="skeleton-sample-line"><span class="cap-skeleton-block" aria-hidden="true"></span></span>
</div>

Centered page spinner

<main aria-busy="true">
  <h1 class="cap-sr-only">Portal</h1>
  <span class="cap-spinner" data-layout="page" role="status" id="sample-page"><svg class="cap-spinner-arc" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="2" opacity="0.25"/><path fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" d="M8 2a6 6 0 0 1 6 6"/></svg><span class="cap-spinner-label">Loading the Portal</span></span>
</main>

API reference

Spinner

PropTypeRequiredDoes
labelstringWhat is loading, in a word or two: "Loading", "Saving".
hideLabelbooleanThe word is for screen readers only while the arc turns (inside a button that already says what it does). Under reduced motion the word always shows.
size"sm" | "lg"
layout"page""page": centered in the space it is given, with its word under it, for a whole page or panel that has nothing else to show yet. It is a status region.

Skeleton

PropTypeRequiredDoes
linesnumber
labelstring

SkeletonBlock

PropTypeRequiredDoes
shape"block" | "circle" | "card"

Parts and data attributes

ClassIs
.cap-skeletonthe root
.cap-skeleton-blocka part
.cap-skeleton-linea part
.cap-spinnerits own class
.cap-spinner-arcits own class
.cap-spinner-labelits own class
AttributeValues
data-labelhidden
data-layoutpage
data-shapecard circle
data-sizelg sm

Accessibility

KeyDoes
NoneA skeleton and a spinner are not interactive. They take no focus.
  • The word is the accessible text; the arc is aria-hidden.
  • The spinner's word is --muted (4.5:1); the arc is 3:1 against its background.
  • A skeleton's gray shapes carry no information; forced colors paint them in GrayText so they do not vanish.
  • Screen readers: no manual NVDA or VoiceOver run, by decision (2026-11-07); the automated browser checks and a front-end review stand in. Automated: see the site's Tests page.