Skeleton loading
Reserve interface structure while content loads and reduce perceptual layout shifts.
Live preview
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.
| Identifier | Contract |
|---|---|
xsh-skeleton | Used by the example markup and component styles or behavior. |
xsh-skeleton--circle | Used by the example markup and component styles or behavior. |
xsh-skeleton--title | Used by the example markup and component styles or behavior. |
aria-busy | Used 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.