Skip to content
Xshna.cssv1.0.0-beta.2
PlaygroundUtilities
DOCUMENTATION / INTERACTIONS
Interactions / Component reference

Table sort and filtering

Client-side sorting and filtering for ordinary HTML tables.

V1 BETA / DOCUMENTEDLive variants · API · Accessibility · Responsive guidance

Overview

Add data-xsh-sort=text|number|date to buttons in th and use aria-sort on the heading. Set data-xsh-filter="#xsh-table-id" on an input to filter visible rows.

Live example

Interactive · Real framework
Matching rows: 3
Amara82
Ben94
Charu88

Example markup

<div class="xsh-stack">
 <label class="xsh-label" for="xsh-table-search">Filter team</label><input class="xsh-input" id="xsh-table-search" placeholder="Search by name..." data-xsh-filter="#xsh-sortable-table" data-xsh-filter-count="#xsh-results-count"><small class="xsh-muted">Matching rows: <span id="xsh-results-count">3</span></small>
 <div class="xsh-table-responsive"><table class="xsh-table" id="xsh-sortable-table"><thead><tr><th scope="col"><button data-xsh-sort="text">Name ↕</button></th><th scope="col"><button data-xsh-sort="number">Score ↕</button></th></tr></thead><tbody><tr><td>Amara</td><td>82</td></tr><tr><td>Ben</td><td>94</td></tr><tr><td>Charu</td><td>88</td></tr></tbody></table></div>
</div>

Production guidance

This is in-memory DOM sorting only, not server-side pagination. Use server filtering for large datasets.

Customize this component through --xsh-* CSS tokens, data-xsh-* configuration attributes and documented xsh-* utilities. Use the optional JavaScript distribution only when an interactive behavior is needed.

EXACT NAMES FROM THE SHIPPED STYLESHEETS

Complete selector inventory

These selectors exist in the current distribution. An entry in this table does not imply that arbitrary modifier combinations are meaningful; use the examples above for the intended composition.

ClassPurposeDelivery
.xsh-tableCore componentCSS-only
.xsh-table-compactComposable modifier / structure classCSS-only
.xsh-table-hoverComposable modifier / structure classCSS-only
.xsh-table-responsiveComposable modifier / structure classCSS-only
.xsh-table-stickyComposable modifier / structure classCSS-only
.xsh-table-stripedComposable modifier / structure classCSS-only
.xsh-table-wrapComposable modifier / structure classCSS-only
ENGINEERING AND INTEGRATION

Implementation details

Semantic structure

A semantic table preserves relationships between column headers and cells.

Compose existing xsh- classes on the appropriate HTML element. Keep content order meaningful when CSS is disabled.

Interactive behavior

For wide tables provide scrolling instead of clipping data.

Load xshna.min.js only if the documented interaction needs it. Your application remains responsible for data, persistence and business rules.

Responsive and localization

Sortable columns need descriptive button labels and current sort direction.

Test 320px-wide viewports, container-constrained instances, keyboard zoom, longer translations and right-to-left text where relevant.

Theme and customization

Use --xsh-* CSS variables for theme values and data-xsh-design / data-xsh-density on the xsh-app root.

Prefer design tokens over hard-coded overrides so components remain coherent across personalities.

ACCEPTANCE CHECKLIST

What to verify before shipping

  • Confirm every documented class used by the feature exists in the release CSS.
  • Navigate controls using Tab, Shift+Tab, Enter, Space and Escape where appropriate.
  • Test with reduced motion, high contrast, 200% text zoom and a narrow mobile viewport.
  • Verify disabled, loading, empty, error and long-content states where relevant.
  • Check actual application behavior independently of the preview: these examples use illustrative data.