Skip to main content
Version: Next

Table

Table wraps ui-table and expects a real HTML <table> as children.

Basic Usage​

Live Editor
function TeamTable() {
  return (
    <ThemeProvider>
      <Table striped hover>
        <table>
          <thead>
            <tr>
              <th data-key="name">Name</th>
              <th data-key="role">Role</th>
              <th data-key="status">Status</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>Ava Johnson</td>
              <td>Designer</td>
              <td>Active</td>
            </tr>
            <tr>
              <td>Liam Carter</td>
              <td>Engineer</td>
              <td>Review</td>
            </tr>
          </tbody>
        </table>
      </Table>
    </ThemeProvider>
  );
}
Result
Loading...

Props​

PropTypeDefaultDescription
sortablebooleanfalseEnable sortable header cells
selectablebooleanfalseEnable row selection
multiSelectbooleanfalseAllow multiple selected rows
stripedbooleanfalseZebra-strip rows
hoverbooleanfalseHover row feedback
compactbooleanfalseReduce row density
borderedbooleanfalseAdd stronger borders
stickyHeaderbooleanfalseKeep the header visible while scrolling
loadingbooleanfalseShow loading state
headlessbooleanfalseRemove default styling
emptyTextstring-Empty-state label
onSortChange(detail) => void-Host sort-change event
onRowSelect(detail) => void-Host row-select event

Sortable Headers​

Add data-key to sortable header cells so the custom element can emit meaningful sort details.

<Table sortable onSortChange={(detail) => console.log(detail.key, detail.direction)}>
<table>
<thead>
<tr>
<th data-key="name">Name</th>
<th data-key="updated">Last updated</th>
</tr>
</thead>
<tbody>{/* rows */}</tbody>
</table>
</Table>

Selectable Rows​

<Table selectable multiSelect onRowSelect={(detail) => console.log(detail.indices)}>
<table>
<thead>
<tr>
<th data-key="name">Name</th>
<th data-key="role">Role</th>
</tr>
</thead>
<tbody>{/* rows */}</tbody>
</table>
</Table>

Notes​

  • Use semantic HTML table markup inside Table.
  • For pagination, filtering, virtualization, and richer state, use DataTable instead.