Native Web Components playground

Nova v3.37.0

Preview

Web Components

Table Header

nv-tableheader

A sortable column heading for an nv-table.

Parts

Live demo

Place nv-tableheader inside a th to make a column heading sortable. With sortable, it shows a sort arrow, can be focused, and cycles sortDirection through none, asc and desc on click, Enter or Space. It reports the direction with aria-sort and emits sortDirectionChanged; your application sorts the rows and resets the other headers.

Anatomy

The table anatomy shows sortable table headers in the header row of the table composition.

Usage

The Datatable design's header-cell partial can show a label, a checkbox, a sort control or a help icon. This component supplies the sort control; place custom label/help content in its default slot. Build a select-all checkbox separately inside its own th and connect it to row selection. Provide the th with scope="col", and preserve a meaningful label for a sortable heading.

Sources