Native tabular data with captions, header, body and footer regions, and pinned edges for scrolling.
<tp-table>
Table
Default density
Compact density
Restart from the initial state
Show the copyable source
A list of your recent invoices.InvoiceStatusMethodAmountINV-1042PaidVisa •••• 4242$250.00INV-1043PendingPayPal$150.00INV-1044UnpaidBank transfer$350.00Total$750.00
A list of your recent invoices.InvoiceStatusMethodAmountINV-1042PaidVisa •••• 4242$250.00INV-1043PendingPayPal$150.00INV-1044UnpaidBank transfer$350.00Total$750.00
Each part renders its native table element, so column layout, colspan, rowspan and header relationships work as in plain HTML. Use tp-table-head with scope="row" for the cell that names a row. Table is for reading data; it has no grid keyboard model, so compose Buttons, Menus or Inputs in cells for actions. Native and custom composition share the same overflow, geometry and theme owner. Do not mix the two anatomies within one Table or add interactive-grid roles.
Status and actions
Badges and menus
Default density
Compact density
Restart from the initial state
Show the copyable source
selection-presentation="row" paints rows marked selected. Selection itself belongs to your application, usually driven by a Checkbox in each row; hovering never selects.
Sticky header and columns
Sticky edges
Default density
Compact density
Restart from the initial state
Show the copyable source
Constrain the Table with ordinary CSS such as max-block-size, and it becomes a focusable scroll region named by label. sticky-header, sticky-footer, sticky-start-columns and sticky-end-columns pin each edge independently and follow RTL: here the region names and the half-year totals stay in view while the months scroll between them. Use normal table/column CSS for content width. The component measures actual column geometry; it has no fixed column-width or spacing attributes. A cell spanning across a pinned/unpinned boundary stays unpinned. Column offsets update after native layout changes, resizing, inserted/removed rows or changed spans.
Wrapping text
Cells keep their text on one line, so data columns stay aligned and a wide Table scrolls. For descriptions and other prose, set white-space: normal on the Table, a row or a cell. Sizes and alignment set on a head or cell reach its native cell: min-inline-size keeps a prose column readable on a narrow screen, and inline-size fixes a column’s width.
Prose column
Default density
Compact density
Restart from the initial state
Show the copyable source
TeaWaterNotesSencha70 °CSteep for one minute in water well below boiling. Hotter water draws out bitterness and hides the grassy sweetness, so let the kettle rest before pouring.Oolong90 °CRinse the leaves once to wake them, then brew short infusions of twenty to thirty seconds. The same leaves give five or six cups, each a little deeper than the last.Assam100 °CSteep for four minutes at a full boil. The brew is strong and malty enough to take milk and sugar without losing its character.
TeaWaterNotesSencha70 °CSteep for one minute in water well below boiling. Hotter water draws out bitterness and hides the grassy sweetness, so let the kettle rest before pouring.Oolong90 °CRinse the leaves once to wake them, then brew short infusions of twenty to thirty seconds. The same leaves give five or six cups, each a little deeper than the last.Assam100 °CSteep for four minutes at a full boil. The brew is strong and malty enough to take milk and sugar without losing its character.
<tp-table label="Brewing guide" style="white-space:normal">
<tp-table-header>
<tp-table-row>
<tp-table-head>Tea</tp-table-head>
<tp-table-head style="inline-size:6rem">Water</tp-table-head>
<tp-table-head>Notes</tp-table-head>
</tp-table-row>
</tp-table-header>
<tp-table-body>
<tp-table-row>
<tp-table-head scope="row">Sencha</tp-table-head>
<tp-table-cell>70 °C</tp-table-cell>
<tp-table-cell style="min-inline-size:15rem">Steep for one minute in water well below boiling. Hotter water draws out bitterness and hides the grassy sweetness, so let the kettle rest before pouring.</tp-table-cell>
</tp-table-row>
<tp-table-row>
<tp-table-head scope="row">Oolong</tp-table-head>
<tp-table-cell>90 °C</tp-table-cell>
<tp-table-cell style="min-inline-size:15rem">Rinse the leaves once to wake them, then brew short infusions of twenty to thirty seconds. The same leaves give five or six cups, each a little deeper than the last.</tp-table-cell>
</tp-table-row>
<tp-table-row>
<tp-table-head scope="row">Assam</tp-table-head>
<tp-table-cell>100 °C</tp-table-cell>
<tp-table-cell style="min-inline-size:15rem">Steep for four minutes at a full boil. The brew is strong and malty enough to take milk and sugar without losing its character.</tp-table-cell>
</tp-table-row>
</tp-table-body>
</tp-table>
API Reference
Every element also accepts motion-policy.
Attributes
AttributePropertyTypeDefaultDescriptionlabellabelstring'Data table'Names the scrollable region that holds the table; a caption names the table itself.layoutlayout'automatic' | 'fixed''automatic'The native table layout algorithm: fixed sizes columns from the first row and ignores content width.selection-presentationselectionPresentation'none' | 'row''none'row paints rows marked selected; the selection itself belongs to the application.sticky-headerstickyHeaderbooleanfalsePins the whole header, every header row included, to the top of the scrolling region.sticky-footerstickyFooterbooleanfalsePins the footer, such as a totals row, to the bottom of the scrolling region.sticky-start-columnsstickyStartColumnsnumber0How many leading columns stay pinned at the inline start while the others scroll.sticky-end-columnsstickyEndColumnsnumber0How many trailing columns stay pinned at the inline end; leading columns win where the counts overlap.
Slots
SlotDescriptiondefaultThe caption, header, body and footer regions, or one authored native table.
CSS parts
PartDescription::part(table)The overflow region that scrolls the table and holds its pinned edges; focusable while the table scrolls.::part(table-table)The native table.
<tp-table-row>
Slots
SlotDescriptiondefaultThe row's heads and cells.
<tp-table-head>
Slots
SlotDescriptiondefaultThe header text.
<tp-table-cell>
Slots
SlotDescriptiondefaultThe cell content: text or library controls.
Related
Components, widgets and patterns that use this one.