Skip to content

DocsDataData table

PT

Data

Data table

Table with filters, search, selection, column sorting and pagination. It generates fake customers: it's a demo.

data-u="datatable"Demo

Example

Installation

Data table ships in the full package, in unslop.css and unslop.js:

curl -fsSL unslop.leallabs.dev/i | sh

A ready-made block that uses data table:

curl -fsSL unslop.leallabs.dev/i | sh -s add wall-table

No build Name-based add is for charts and blocks. Components with JS live in unslop.js, which mounts every data-u on the page by itself.

Props

They go in data-u-props, as JSON.

PropTypeDefaultWhat it does
pageSizenumber5Rows per page.
countnumber48How many fake rows to generate.
rowsarrayno defaultRows in the demo's internal format (id, name, c, product, region, status, del, date, price). For real data, build the u-dt markup by hand.

Accessibility and keyboard

State and roles

WhereAttributeWhat it says
tablerole="table", "row", "columnheader", "cell", "rowgroup"Table structure in divs.
sorted columnaria-sortascending or descending.
paginationrole="navigation", aria-current="page"The current page is marked.
checkboxes and filtersaria-labelEach with its own name.

Keyboard

KeyDoes
Tabmoves through filters, search, headers and pagination
Entersorts by the focused column
Spacingchecks the row

Events and API

EventdetailWhen
u:change{ value, label, index }Comes from the inner selects (filters and status) and bubbles up the page. Filter by target if you listen on document.

Every event bubbles up the page. Listen on the element itself: el.addEventListener("u:change", (e) => e.detail).

Type to search. Arrows pick, Enter opens.