Skip to content
CdsTable

Filters and sorting

Filters and sorting are described right on the columns: a filter menu with nested items, sorting by one or several columns, controlled state with a reset and your own filter panel.

Storybook GitLab Figma
Test coverage: 0% — low coverage
API in specs
0 / 72 props, events, slots and exposed members with a test
Test cases
13 unit · 0 browser
Code coverage
15.2% lines · 7.4% branches measured in v4.0.0-alpha.13
A11y (axe)
50 recommendations in 39 stories measured in v4.0.0-alpha.11

Filters and sorting ​

The column filter menu is set by filters and onFilter, the sorting by the sorter function. sortDirections lists the directions, defaultSortOrder sets the initial order, and filterMultiple: false switches the filter to single choice. Every change is reported by the change event.

Multiple sorting ​

A sorter object with a multiple field allows sorting by several columns at once — the number sets the column's priority in the chain.

Resetting filters and sorting ​

The filteredValue and sortOrder column props make the state controlled: keep it outside, update it in the change handler — and reset it with buttons in a single assignment.

Custom filter panel ​

The column's customFilterDropdown: true flag enables the customFilterDropdown and customFilterIcon slots — the filter panel and its icon are drawn by your markup, a search field for example.