xxshna.ui
V 1.1.0Get started ↗
Components/Data display

Selection tables

Select multiple table rows and reveal a bulk-action count.

Catalog · 1.1HTML, CSS & optional JSNo runtime dependencies

Live preview

Interactive exampleOpen playground ↗
0 selected
DocumentStage
ProposalReview
InvoiceApproved
ContractDraft
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.

IdentifierContract
data-xsh-select-tableUsed by the example markup and component styles or behavior.
data-xsh-check-allUsed by the example markup and component styles or behavior.
data-xsh-check-rowUsed by the example markup and component styles or behavior.
data-xsh-selected-countUsed 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.