Selection tables
Select multiple table rows and reveal a bulk-action count.
Live preview
selected
| Document | Stage | |
|---|---|---|
| Proposal | Review | |
| Invoice | Approved | |
| Contract | Draft |
HTML
<div data-xsh-select-table>
<div class="xsh-row" style="justify-content:space-between;margin-bottom:12px">
<strong>
<output data-xsh-selected-count>0</output> selected</strong>
<button class="xsh-button xsh-button--secondary xsh-button--sm" data-xsh-toast="info" data-xsh-message="Implement bulk processing in your application.">Review selection</button>
</div>
<div class="xsh-table-wrap">
<table class="xsh-table">
<thead>
<tr>
<th>
<input type="checkbox" data-xsh-check-all aria-label="Select all rows">
</th>
<th>Document</th>
<th>Stage</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="checkbox" data-xsh-check-row aria-label="Select proposal">
</td>
<td>Proposal</td>
<td>Review</td>
</tr>
<tr>
<td>
<input type="checkbox" data-xsh-check-row aria-label="Select invoice">
</td>
<td>Invoice</td>
<td>Approved</td>
</tr>
<tr>
<td>
<input type="checkbox" data-xsh-check-row aria-label="Select contract">
</td>
<td>Contract</td>
<td>Draft</td>
</tr>
</tbody>
</table>
</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 |
|---|---|
data-xsh-select-table | Used by the example markup and component styles or behavior. |
data-xsh-check-all | Used by the example markup and component styles or behavior. |
data-xsh-check-row | Used by the example markup and component styles or behavior. |
data-xsh-selected-count | Used by the example markup and component styles or behavior. |
Accessibility & keyboard
Select all toggles rows; individual changes maintain indeterminate and count states.
Implementation note. Selecting is local only. Bulk operations must request confirmation where necessary.
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.