Skip to content

Signal

Components

Table

Data tables with a muted header row; wrap in .ct-table-wrap to scroll sideways.

Live example

Rendered with the real classes from /site/chitransit.css, light (left) and dark (right).

KeyCallsShare
ios41,20062%
web9,87015%
.ct-table-wrap · .ct-table--numeric

Code

<div class="ct-table-wrap"><table class="ct-table ct-table--numeric"><tr><th>Key</th><th>Calls</th><th>Share</th></tr><tr><td>ios</td><td>41,200</td><td>62%</td></tr><tr><td>web</td><td>9,870</td><td>15%</td></tr></table></div>

Tokens

From tokens/components.tokens.json. Override one instance by setting the property without the ct- prefix.

Custom propertyValueAliasResolves to
--ct-table-cell-padding-xvar(--space-12){space.s12}12 pt
--ct-table-cell-padding-yvar(--space-10){space.s10}10 pt
--ct-table-font-sizevar(--fs-sub){type.sub}13
--ct-table-framevar(--shadow-frame){shadows.frame}
--ct-table-head-backgroundvar(--card){colors.card}#EDEEF1 #1D232D
--ct-table-head-colorvar(--muted){colors.muted}#5B6472 #B0BACA
--ct-table-head-font-sizevar(--fs-cap){type.cap}12
--ct-table-head-tracking.04em
--ct-table-rulevar(--line){colors.line}#DADDE3 #263041

Variants

.ct-table is the default; --numeric right-aligns every column but the first. Wrap either in .ct-table-wrap. Nothing else exists.

<!-- Do -->
<div class="ct-table-wrap">
  <table class="ct-table ct-table--numeric">
    <tr><th>Key</th><th>Calls</th></tr>
    <tr><td>ios</td><td>41,200</td></tr>
  </table>
</div>
<!-- Don't: headers in <td>, or a table for layout -->
<table class="ct-table"><tr><td><b>Key</b></td><td><b>Calls</b></td></tr></table>

Usage

Do

  • Wrap a table in .ct-table-wrap so it scrolls sideways on narrow screens.
  • Use --numeric to right-align digits with tabular figures.

Don't

  • Don't use tables for layout.

Accessibility

  • Use <th> for headers so screen readers announce them per cell.