Empty states
Provide a useful next step when a section contains no records.
Live preview
No projects yet
Projects you create will appear here, along with their members and activity.
HTML
<div class="xsh-empty" style="width:100%;max-width:450px">
<div class="xsh-empty__mark" aria-hidden="true">▦</div>
<h3 class="xsh-empty__title">No projects yet</h3>
<p class="xsh-empty__text">Projects you create will appear here, along with their members and activity.</p>
<button class="xsh-button" data-xsh-toast="info" data-xsh-message="Connect this action to your application project form.">Create a project</button>
</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-empty | Used by the example markup and component styles or behavior. |
xsh-empty__mark | Used by the example markup and component styles or behavior. |
xsh-empty__title | Used by the example markup and component styles or behavior. |
xsh-empty__text | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Use a heading and direct explanation; keep the action label descriptive.
Implementation note. Never hide an error behind a generic empty state; explicitly distinguish no data from failed loading.
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.