ConstRenders the table frame and shares its scroll container and density with compound parts.
<Table density="compact" striped caption="Invoices">
<Table.Head>
<Table.Row>
<Table.SelectAllCell checked={allSelected} onCheckedChange={toggleAll} />
<Table.HeaderCell sortable sortDirection={sortDir} onSort={setSortDir}>Customer</Table.HeaderCell>
<Table.HeaderCell align="end">Amount</Table.HeaderCell>
</Table.Row>
</Table.Head>
<Table.VirtualBody items={invoices} estimateRowHeight={48} getItemKey={(invoice) => invoice.id}>
{(invoice) => (
<Table.Row key={invoice.id} selected={selected.has(invoice.id)}>
<Table.SelectionCell aria-label={`Select ${invoice.customer}`} checked={selected.has(invoice.id)} onCheckedChange={() => toggle(invoice.id)} />
<Table.Cell>{invoice.customer}</Table.Cell>
<Table.Cell align="end">{invoice.amount}</Table.Cell>
</Table.Row>
)}
</Table.VirtualBody>
</Table>
A data table with density from the config, sortable columns, row selection and row virtualization.