Skip to content

Table

Responsive native tables with readable density. CSS only

Table
Copy this markup
<div class="ui-table" role="region" aria-label="Primitive coverage table" tabindex="0">
<table>
<caption>
<span data-ui-part="caption">Primitive coverage</span>
<span data-ui-part="description">CSS-only component contracts in this milestone batch.</span>
</caption>
<thead>
<tr>
<th scope="col">Primitive</th>
<th scope="col">Contract</th>
<th scope="col" data-ui-align="end">Depth</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Badge</th>
<td><code class="ui-code">.ui-badge</code></td>
<td data-ui-align="end">Flat</td>
</tr>
<tr>
<th scope="row">Card</th>
<td><code class="ui-code">.ui-card</code></td>
<td data-ui-align="end">Flat</td>
</tr>
<tr>
<th scope="row">Disclosure</th>
<td><code class="ui-code">details.ui-disclosure</code></td>
<td data-ui-align="end">Native</td>
</tr>
</tbody>
</table>
</div>

Install

Styles and registration
import '@timelessui/components/css/tokens.css'
import '@timelessui/components/css/badge.css'
import '@timelessui/components/css/table.css'

Anatomy

Parts are authored in your own markup and identified by the selector below, so your CSS can target the same anatomy without loading Timeless styles. Required parts must be present for the component to work. Private data-ui-internal-* hooks are written by the runtime and must never be authored.

PartRequiredSelectorPurpose
captionNo[data-ui-part~='caption']Table name. Use <caption>.
descriptionNo[data-ui-part~='description']Supporting copy inside the caption.
emptyNo[data-ui-part~='empty']Row shown in place of data when the table has none.

Attributes

Every value below is implemented by the stylesheets this component ships. Boolean attributes are presence-based: author the attribute with no value, or omit it.

AttributeValuesDefaultDescription
data-ui-densitycompact · normalnormalCell padding.
data-ui-alignstart · endstartCell text alignment. Set it on a <th> or <td>, not on the table. end also enables tabular numerals.

Styling

Root identity: ui-table. Required stylesheets: tokens.css, badge.css, table.css.

This component adds no custom properties of its own. Restyle it through the design tokens or your own CSS.

Design tokens this component reads (21)

These are global Atmosphere tokens. Change them once at the theme level rather than per component.

--ui-accent-soft · --ui-bg-control-muted · --ui-bg-surface · --ui-bg-surface-raised · --ui-danger · --ui-danger-soft · --ui-fg · --ui-fg-muted · --ui-focus · --ui-line · --ui-radius-lg · --ui-radius-pill · --ui-space-1 · --ui-space-2 · --ui-space-3 · --ui-space-4 · --ui-space-5 · --ui-success · --ui-success-soft · --ui-warning · --ui-warning-soft

Accessibility

Keep the native elements, roles, and relationships shown in the example. Timeless adds only the state and keyboard coordination the platform does not already provide, and it never supplies your accessible names — those depend on your content.

Before JavaScript runs

This primitive is CSS only. There is nothing to register and nothing to wait for.

More examples

Open Table in StoryLite for variants, controls, and manual testing.