Skip to content

CSS: table ​

.instui-table — A styled data table for th and td plus an optional caption, with hover, fixed, and stacked-card layouts.

For tables that must retain their columns, use a named, keyboard-focusable --overflow-x-auto container instead. Use -without-focus-animation for an immediately visible focus outline and the caption to name the region.

Source: body.css

Usage ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/table.css";

Examples ​

html
<div class="instui-view --overflow-x-auto -focus-position-inset -without-focus-animation" role="region" aria-labelledby="table-caption" tabindex="0">
<table class="instui-table -hover">
  <caption id="table-caption">Top-rated films</caption>
  <thead>
    <tr>
      <th scope="col">Rank</th>
      <th scope="col">Title</th>
      <th scope="col">Year</th>
      <th scope="col">Rating</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">1</th>
      <td>The Shawshank Redemption</td>
      <td>1994</td>
      <td>9.3</td>
    </tr>
    <tr>
      <th scope="row">2</th>
      <td>The Godfather</td>
      <td>1972</td>
      <td>9.2</td>
    </tr>
    <tr>
      <th scope="row">3</th>
      <td>The Godfather: Part II</td>
      <td>1974</td>
      <td>9.0</td>
    </tr>
  </tbody>
</table>
</div>
<div class="instui-container">
  <table class="instui-table -layout-responsive">
    <caption>Responsive film ratings</caption>
    <thead>
      <tr><th scope="col">Title</th><th scope="col">Year</th><th scope="col">Rating</th></tr>
    </thead>
    <tbody>
      <tr><td data-label="Title">The Shawshank Redemption</td><td data-label="Year">1994</td><td data-label="Rating">9.3</td></tr>
      <tr><td data-label="Title">The Godfather</td><td data-label="Year">1972</td><td data-label="Rating">9.2</td></tr>
    </tbody>
  </table>
</div>

Structure ​

text
.instui-table.-hover
  caption
  thead
    th
  tbody
    tr
      td, th[scope="row"]
flowchart TD n0[".instui-table.-hover"]:::cssdoc-root n1("caption"):::cssdoc-part n2("thead"):::cssdoc-part n3("th"):::cssdoc-part n4("tbody"):::cssdoc-part n5("tr"):::cssdoc-part n6("td, th[scope=&quot;row&quot;]"):::cssdoc-part n0 --> n1 n2 --> n3 n0 --> n2 n5 --> n6 n4 --> n5 n0 --> n4 classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modifiers ​

ModifierDescription
.-hoverHighlight rows on hover. @affects table.row — Reserves and colours the row's hover border.
.-layout-fixedFixed table layout (equal-width columns).
.-layout-responsiveUse stacked cards below the canonical md container breakpoint; preserve columns at and above it. Requires per-cell data-label values and a size-container ancestor. @affects table.head @affects table.body @affects table.row @affects table.cell @affects table.col-header @affects table.row-header — Applies the existing stacked presentation only in a narrow container.
.-layout-stackedStack each row as a card, via a per-cell data-label. @affects table.head @affects table.body @affects table.row @affects table.cell @affects table.col-header @affects table.row-header — Stacks each part as a block and hides/labels the header accordingly.

Parts ​

PartDescription
.captionAn optional table caption.

Conditions ​

TypeQueryDescription
container(width < 48em)—

Accessibility ​

Label the table with a <caption>, mark column headers <th scope="col"> and row headers <th scope="row">, and in stacked or responsive layouts give every cell a localized data-label matching its column header. Keep the native header associations; visible generated labels don't replace them. Name scroll regions and provide keyboard access without trapping focus.

ConditionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6PassPassPassPass
reflow-at-320pxWCAG 2.2 1.4.10PassPassPassPass
text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
Screen reader (simulated)Rebrand (light)Rebrand (dark)CanvasCanvas High Contrast
AnnouncementsPassPassPassPass

These automated results do not establish that the page meets WCAG; manual review is still needed.

Tokens consumed ​

TokenTypeValue
--instui-component-table-background<color>LightDarklight-dark(#ffffff, #10141A)
--instui-component-table-cell-padding-horizontal<length>0.75rem
--instui-component-table-cell-padding-vertical<length>0.5rem
--instui-component-table-col-header-color<color>LightDarklight-dark(#273540, #F2F4F5)
--instui-component-table-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-component-table-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-table-font-size<length>1rem
--instui-component-table-head-font-weight<integer>600

Subcomponents ​