Table — Vanilla
Data table with vanilla HTML. Same BEM and behavior as Astro: sorting, filtering, striped rows. Ensure Rizzo CSS is loaded.
Table
Data table with the same BEM classes and behavior as the Astro Table: table, table__wrapper, table__table, table__caption, table__head, table__body, table__row, table__cell, table__cell--head. Add table--striped for alternating rows, table--sortable for sortable headers, table--filterable for the filter input. Use data-table-sortable="true" and data-table-filterable="true" on the wrapper so the script below initializes sorting and filtering.
Basic
Same as Astro: sortable column headers (click or Enter/Space) and optional filter input with icon.
| Alice | Developer | Active |
| Bob | Designer | Active |
| Carol | Manager | Away |
With sorting (number column)
Sortable column headers: click or Enter/Space. Set data-type="number" on th for numeric sort.
| Alice | 92 | 3 |
| Bob | 87 | 2 |
| Carol | 95 | 4 |
With filter
Filter input above the table: rows are shown/hidden by matching text in any cell.
| Alice | Developer | Active |
| Bob | Designer | Active |
| Carol | Manager | Away |
| Dave | Developer | Active |
Without stripes
| 1 | 2 |
| 3 | 4 |
Features
- Accessible — Semantic
<table>,<caption>,scope="col",aria-sorton sortable headers, keyboard (Enter/Space) to sort. - Sorting — Sortable column headers with Sort icon; click to sort ascending/descending;
data-type="number"onthfor numeric sort. - Filtering — Optional filter input with Filter icon; rows shown/hidden by matching text in any cell.
- Striped rows — Add
table--stripedfor alternating row background. - Responsive — Table wrapper scrolls horizontally on small screens.