Skip to content

Table ​

A semantic, accessible data table component with striped rows, borders, sticky header, and responsive horizontal scrolling. Use <ore-tr head> for header rows, <ore-tr foot> for footer rows, plain <ore-tr> for body rows, with <ore-th> and <ore-td> for cells.

Striped Rows ​

The striped attribute applies alternating row backgrounds, making it easier to track across wide tables. Prefer striped for tables with many rows and few columns to aid row tracking.

Full width

Bordered ​

The bordered attribute adds an outer border and radius around the whole table.

Full width

Fullwidth ​

The fullwidth attribute expands the table to fill 100% of its container width.

Full width

Density ​

Control cell padding with the density attribute. Font size is unaffected. Use density="compact" for dense dashboard tables; density="comfortable" when more breathing room is needed. The default density="cozy" suits most cases.

Full width

Set sticky to keep the header row visible when the table body scrolls. Set --table-sticky-max-height to control the scroll viewport height (default 24rem). Only use sticky when the table has enough rows to require scrolling; pair it with --table-sticky-max-height.

Full width

Loading State ​

The loading attribute dims the table and sets aria-busy="true" while data is being fetched. Use loading to indicate async data fetching instead of hiding or removing the table.

Full width

Caption ​

The caption attribute renders a visible label above the table and also serves as the accessible aria-label. Always use the caption attribute on every data table to give it an accessible label.

Full width

Combining Options ​

Mix attributes for a fully styled, accessible table.

Full width

Recipes ​

Common product patterns composed from existing refine parts — no extra components needed.

Table Card ​

Wrap the table in ore-card with padding="none" so it sits flush, and use the header slot for the title, status badge, and trailing actions.

Full width

Row Actions ​

Give each row a menu trigger. Keep the actions column narrow and unlabelled so the data stays primary; screen readers still get a labelled trigger.

Full width

API Reference ​

Attributes ​

AttributeTypeDefaultDescription
captionstringN/AVisible caption rendered above the table
density'compact' | 'cozy' | 'comfortable''cozy'Cell padding; compact = tight, cozy = default, comfortable = spacious
stripedbooleanfalseAlternating row background
borderedbooleanfalseOuter border and rounded corners
fullwidthbooleanfalseExpands the table to 100% of its container width
stickybooleanfalseStick the header row to the top while body scrolls
loadingbooleanfalseDims the table and sets aria-busy="true"

Child Elements ​

ore-table reads light-DOM marker elements and projects them into a native shadow <table>. There are no slots: child elements are observed via MutationObserver. Always use <ore-th> (not <ore-td>) for header cells: scope is inferred automatically.

ElementDescription
<ore-tr head>Header row: projected into <thead>
<ore-tr>Body row: projected into <tbody>
<ore-tr foot>Footer row: projected into <tfoot>
<ore-th>Header cell: mirrored as native <th>; scope is auto-inferred if omitted
<ore-td>Data cell: mirrored as native <td>; supports colspan, rowspan, etc.

Mirrored Attributes ​

Attributes on <ore-th> and <ore-td> are forwarded to the generated native <th>/<td> in the shadow tree.

AttributeElementsDescription
colspanore-th, ore-tdSpans multiple columns
rowspanore-th, ore-tdSpans multiple rows
alignore-th, ore-tdText alignment: left | center | right
scopeore-thColumn/row association: auto-inferred if absent
headersore-th, ore-tdAssociates cell with header IDs

Parts ​

PartDescription
scrollOverflow container: target for max-height / scrolling
tableGenerated native <table> element
headGenerated native <thead> element
bodyGenerated native <tbody> element
footGenerated native <tfoot> element
cellEvery native <td> in <tbody> rows
header-cellEvery native <th> / <td> in <thead> and <tfoot> rows

CSS Custom Properties ​

PropertyDescription
--table-bgTable background color
--table-border-colorCell separator and outer border color
--table-radiusCorner radius (applied when bordered)
--table-shadowBox shadow on the host element
--table-header-bgBackground of <thead> and <tfoot>
--table-accentAccent color used for hover states
--table-row-hover-bgRow background on hover
--table-stripe-bgEven-row background when striped
--table-cell-padding-xHorizontal cell padding
--table-cell-padding-yVertical cell padding
--table-font-sizeBase font size for all cells
--table-sticky-max-heightMax height of the scroll container when sticky
--table-sticky-header-bgBackground of the sticky <thead> (with blur)
--table-sticky-blurBackdrop blur intensity on the sticky header

Customization ​

Full width

Accessibility ​

The table component follows WCAG 2.1 Level AA standards.

When loading is active, aria-busy is set to "true" so screen readers can announce that the table content is being updated. When a caption is provided, it is used as the aria-label for the table, giving assistive technologies a clear label for the data.

The native <table>, <thead>, <tbody>, and <tfoot> elements are owned by ore-table's shadow DOM, preserving all table semantics for assistive technologies. <ore-th> elements in a <ore-tr head> row automatically receive scope="col" on the generated native <th>, while <ore-th> in a body row automatically gets scope="row". Provide an explicit scope attribute to override either default.

Standard browser table keyboard navigation applies, including Tab and arrow key navigation with screen readers. Avoid placing interactive elements such as buttons or inputs inside cells without ensuring their keyboard accessibility.