Sparklines
Present a compact visual trend with a textual description.
Live preview
Request throughput12.4k / day
HTML
<figure class="xsh-spark">
<div>
<span>Request throughput</span>
<strong>12.4k / day</strong>
</div>
<svg viewBox="0 0 240 70" role="img" aria-label="Illustrative rising trend">
<polyline fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" points="0,58 22,48 44,52 66,40 88,48 110,29 132,35 154,18 176,30 198,14 220,20 240,5"/>
</svg>
<figcaption>Example trend over twelve periods</figcaption>
</figure>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-spark | Used by the example markup and component styles or behavior. |
svg | Used by the example markup and component styles or behavior. |
figure | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
SVG exposes an accessible label and text supplies the primary metric.
Implementation note. For real dynamic plots, provide a data table and automated SVG updates.
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.