>
Name
Age>
>Ada Lovelace>36>
>Grace Hopper>85>
>Alan Turing>41
Drag the "Name" column's trailing edge to resize it — the whole column, header and body cells alike, follows.
Pagination
lit-material-data-table-pagination is a standalone footer control — it doesn't touch the
table directly. Slice your own data by its page-change event and re-render the rows.
10,000 rows, but set .items/.rowRenderer and only the rows near the visible
scroll window are ever mounted — scroll and check the DOM node count in devtools.
Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide
API
<lit-material-data-table-cell>
A single cell inside a lit-material-data-table-row.
Properties
Property
Attribute
Type
Default
Description
header
header
boolean
false
>
numeric
numeric
boolean
false
>
sortKey
sort-key
string | undefined
none
>
sortDirection
sort-direction
SortDirection
"none"
Kept in sync by the parent table — see the class docs. Not meant to be set directly.
resizable
resizable
boolean
false
Adds a drag handle at the trailing edge. Only meaningful on a header cell.
minWidth
min-width
number
60
Floor for the width this cell's handle will report while dragging.
flex
flex
boolean
false
Lays the cell out with flexbox instead of display: table-cell — see lit-material-data-table-row.
width
width
string | undefined
none
This cell's width in flex mode (any CSS flex-basis value, e.g. "96px"). Ignored otherwise.
Events
Event
Description
column-resize
detail: { width } (pixels), while dragging a resizable cell's handle.
Slots
Slot
Description
default
The cell's content.
CSS parts
Part
Description
sort-button
The button wrapping content, for sortable header cells.
sort-icon
The ascending/descending indicator.
resize-handle
The drag handle for a resizable header cell.
<lit-material-data-table-pagination>
A pagination footer for lit-material-data-table — a standalone,
headless control rather than something the table renders itself, since
the table never owns your data (see its own class docs) and paging is
exactly as data-shaped a concern as sorting/selection. Place one below a
table, feed it total/page/page-size, and re-render (or re-fetch) the
table's rows in response to page-change — this component never touches
the table directly.
Properties
Property
Attribute
Type
Default
Description
page
page
number
0
0-based current page index.
pageSize
page-size
number
10
>
total
total
number
0
Total row count across every page — this control has no idea what a "row" is beyond this number.
pageSizeOptions
page-size-options
readonly number[]
[10, 25, 50]
>
unknownTotal
unknown-total
boolean
false
The total isn't known (cursor paging): total is ignored, has-more drives Next.
hasMore
has-more
boolean
false
With unknown-total: there is a page after this one.
disabled
disabled
boolean
false
Disables every control, e.g. while a page loads.
Events
Event
Description
page-change
detail: { page, pageSize }, when a nav button is activated or the page-size select changes (which also resets page to 0).
<lit-material-data-table-row>
A row inside a lit-material-data-table — holds lit-material-data-table-cell children.
Properties
Property
Attribute
Type
Default
Description
header
header
boolean
false
>
selected
selected
boolean
false
Highlights the row — set by the table from a row-select checkbox's checked state, not directly.
flex
flex
boolean
false
Lays the row out with flexbox instead of display: table-row — see the class docs.
Slots
Slot
Description
default
lit-material-data-table-cell elements.
<lit-material-data-table>
Material Design 3 data table — a container for lit-material-data-table-row
elements (each holding lit-material-data-table-cell elements).
Properties
Property
Attribute
Type
Default
Description
sortKey
sort-key
string | undefined
none
>
sortDirection
sort-direction
SortDirection
"ascending"
>
items
property only
readonly unknown[]
[]
The full dataset for virtualized mode. Empty (the default) means "not virtualized".