Bar charts
Present a small labeled comparison using proportional visual bars.
Live preview
Q138
Q267
Q352
Q489
HTML
<figure class="xsh-bars" role="group" aria-label="Example sales by quarter">
<div>
<span>Q1</span>
<i style="--xsh-value:38%">
</i>
<b>38</b>
</div>
<div>
<span>Q2</span>
<i style="--xsh-value:67%">
</i>
<b>67</b>
</div>
<div>
<span>Q3</span>
<i style="--xsh-value:52%">
</i>
<b>52</b>
</div>
<div>
<span>Q4</span>
<i style="--xsh-value:89%">
</i>
<b>89</b>
</div>
<figcaption>Illustrative quarterly index (0–100)</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-bars | Used by the example markup and component styles or behavior. |
--xsh-value | Used by the example markup and component styles or behavior. |
figure | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Each numeric value is presented as text, not color alone.
Implementation note. This component illustrates bars, not a full plotting or chart analytics engine.
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.