xxshna.ui
V 1.1.0Get started ↗
Components/Data display

Skeleton loading

Reserve interface structure while content loads and reduce perceptual layout shifts.

Catalog · 1.1HTML, CSS & optional JSNo runtime dependencies

Live preview

Interactive exampleOpen playground ↗
HTML
<div class="xsh-card" style="width:100%;max-width:420px">
<div class="xsh-card__body">
<div class="xsh-row" style="align-items:start">
<div class="xsh-skeleton xsh-skeleton--circle">
</div>
<div class="xsh-stack" style="flex:1;gap:10px">
<div class="xsh-skeleton xsh-skeleton--title">
</div>
<div class="xsh-skeleton" style="width:85%">
</div>
<div class="xsh-skeleton" style="width:65%">
</div>
</div>
</div>
</div>
</div>

Installation & markup

Include the local stylesheet and script once on the page, then place the component inside a data-xsh-ui root. The example above works without a build system.

<link rel="stylesheet" href="/dist/xshna-ui.css">
<div data-xsh-ui>
  <!-- Add the HTML example above -->
</div>
<script defer src="/dist/xshna-ui.js"></script>

Component API

Public classes, attributes and hooks used by this example. Keep the xsh- prefix intact.

IdentifierContract
xsh-skeletonUsed by the example markup and component styles or behavior.
xsh-skeleton--circleUsed by the example markup and component styles or behavior.
xsh-skeleton--titleUsed by the example markup and component styles or behavior.
aria-busyUsed by the example markup and component styles or behavior.

Accessibility & keyboard

Loading containers should communicate busy status on their parent (aria-busy=true). Skeleton shapes themselves are decorative.

Implementation note. Provide a stable final layout and remove aria-busy once content is loaded.

Interaction contract

Behavioral components use the shared delegated runtime; visual-only primitives rely on semantic HTML and CSS. Runtime controls emit bubbling xsh:* CustomEvents; bind application handlers to those events when server persistence, API data or navigation is required.