ナビゲーション

v2.1.0
データ表示

テーブル

細い罫線でデータ行を区切り、列見出しで並べ替え、数値の桁をそろえられます。

このページの内容

テーブルはデータ行を細い罫線で区切ります。列見出しには控えめなキャプションと少し強めの罫線を使い、データ行は本文色で表示します。<table> に table を指定し、各 <tr> に table-row、列見出しに table-heading、データセルと行見出しに table-cell を指定します。テーブル自体には背景がないため、シート または カード の中に配置します。

テーブル

<div class="sheet overflow-hidden">  <table class="table">    <thead>      <tr class="table-row">        <th class="table-heading" scope="col">Project</th>        <th class="table-heading" scope="col">Status</th>        <th class="table-heading" scope="col">Region</th>        <th class="table-heading table-numeric" scope="col">Requests</th>      </tr>    </thead>    <tbody>      <tr class="table-row">        <th class="table-cell table-primary" scope="row">Atlas</th>        <td class="table-cell"><span class="badge badge-success badge-dot">Ready</span></td>        <td class="table-cell">Tokyo</td>        <td class="table-cell table-numeric">1,284,019</td>      </tr>      <tr class="table-row">        <th class="table-cell table-primary" scope="row">Borealis</th>        <td class="table-cell"><span class="badge badge-warning badge-dot">Degraded</span></td>        <td class="table-cell">Frankfurt</td>        <td class="table-cell table-numeric">94,201</td>      </tr>      <tr class="table-row">        <th class="table-cell table-primary" scope="row">Cirrus</th>        <td class="table-cell"><span class="badge badge-dot">Draft</span></td>        <td class="table-cell">Virginia</td>        <td class="table-cell table-numeric">0</td>      </tr>    </tbody>  </table></div>
<div className="sheet overflow-hidden">  <table className="table">    <thead>      <tr className="table-row">        <th className="table-heading" scope="col">Project</th>        <th className="table-heading" scope="col">Status</th>        <th className="table-heading" scope="col">Region</th>        <th className="table-heading table-numeric" scope="col">Requests</th>      </tr>    </thead>    <tbody>      <tr className="table-row">        <th className="table-cell table-primary" scope="row">Atlas</th>        <td className="table-cell"><span className="badge badge-success badge-dot">Ready</span></td>        <td className="table-cell">Tokyo</td>        <td className="table-cell table-numeric">1,284,019</td>      </tr>      <tr className="table-row">        <th className="table-cell table-primary" scope="row">Borealis</th>        <td className="table-cell">          <span className="badge badge-warning badge-dot">Degraded</span>        </td>        <td className="table-cell">Frankfurt</td>        <td className="table-cell table-numeric">94,201</td>      </tr>      <tr className="table-row">        <th className="table-cell table-primary" scope="row">Cirrus</th>        <td className="table-cell"><span className="badge badge-dot">Draft</span></td>        <td className="table-cell">Virginia</td>        <td className="table-cell table-numeric">0</td>      </tr>    </tbody>  </table></div>
<div class="sheet overflow-hidden">  <table class="table">    <thead>      <tr class="table-row">        <th class="table-heading" scope="col">Project</th>        <th class="table-heading" scope="col">Status</th>        <th class="table-heading" scope="col">Region</th>        <th class="table-heading table-numeric" scope="col">Requests</th>      </tr>    </thead>    <tbody>      <tr class="table-row">        <th class="table-cell table-primary" scope="row">Atlas</th>        <td class="table-cell"><span class="badge badge-success badge-dot">Ready</span></td>        <td class="table-cell">Tokyo</td>        <td class="table-cell table-numeric">1,284,019</td>      </tr>      <tr class="table-row">        <th class="table-cell table-primary" scope="row">Borealis</th>        <td class="table-cell"><span class="badge badge-warning badge-dot">Degraded</span></td>        <td class="table-cell">Frankfurt</td>        <td class="table-cell table-numeric">94,201</td>      </tr>      <tr class="table-row">        <th class="table-cell table-primary" scope="row">Cirrus</th>        <td class="table-cell"><span class="badge badge-dot">Draft</span></td>        <td class="table-cell">Virginia</td>        <td class="table-cell table-numeric">0</td>      </tr>    </tbody>  </table></div>
<template>  <div class="sheet overflow-hidden">    <table class="table">      <thead>        <tr class="table-row">          <th class="table-heading" scope="col">Project</th>          <th class="table-heading" scope="col">Status</th>          <th class="table-heading" scope="col">Region</th>          <th class="table-heading table-numeric" scope="col">Requests</th>        </tr>      </thead>      <tbody>        <tr class="table-row">          <th class="table-cell table-primary" scope="row">Atlas</th>          <td class="table-cell"><span class="badge badge-success badge-dot">Ready</span></td>          <td class="table-cell">Tokyo</td>          <td class="table-cell table-numeric">1,284,019</td>        </tr>        <tr class="table-row">          <th class="table-cell table-primary" scope="row">Borealis</th>          <td class="table-cell"><span class="badge badge-warning badge-dot">Degraded</span></td>          <td class="table-cell">Frankfurt</td>          <td class="table-cell table-numeric">94,201</td>        </tr>        <tr class="table-row">          <th class="table-cell table-primary" scope="row">Cirrus</th>          <td class="table-cell"><span class="badge badge-dot">Draft</span></td>          <td class="table-cell">Virginia</td>          <td class="table-cell table-numeric">0</td>        </tr>      </tbody>    </table>  </div></template>

#セル

セルが行の見出しなら <th class="table-cell" scope="row">、行グループの見出しなら scope="rowgroup" を使います。見出しは先頭側に揃い、--font-weight-control が適用されます。ロールで構成したグリッド内で role="rowheader" を指定した table-cell にも、同じスタイルが適用されます。通常のセルは周囲と同じ文字の太さを保ちます。ブラウザー既定の <th> の中央揃えや太字が、テーブルのリズムを崩すことはありません。

同じクラスを使えば、ARIA ロールで構成したテーブルにも、テーブル、行、セルに対応する表示形式を適用できます。スタンドアロン CSS でも利用できます。

  • table-primary は行を識別するセルに付け、その文字をコントラストの強いインク色で表示します。ほかのセルは本文色のままなので、行の名前が先に目に入ります。
  • 見出しと対応するセルに table-numeric を指定すると、末尾側に揃い、等幅数字で表示されます。桁が縦にそろい、桁数で数値の大きさを比べやすくなります。

#並べ替え

aria-sort="ascending" または aria-sort="descending" を指定した見出しの文字はコントラストの強いインク色になり、並べ替えの方向を示すシェブロンが付きます。順序を変更するには、見出しの中にボタンを置きます。スタイルシートは属性に応じて表示を変え、属性値の設定はスクリプトまたはサーバーが行います。

並べ替え

<div class="sheet overflow-hidden">  <table class="table table-compact">    <thead>      <tr class="table-row">        <th class="table-heading" scope="col" aria-sort="ascending">          <button type="button" class="table-sort">Name</button>        </th>        <th class="table-heading" scope="col">Role</th>        <th class="table-heading table-numeric" scope="col">          <button type="button" class="table-sort">Deployments</button>        </th>      </tr>    </thead>    <tbody>      <tr class="table-row">        <td class="table-cell table-primary">Ada Lovelace</td>        <td class="table-cell">Owner</td>        <td class="table-cell table-numeric">412</td>      </tr>      <tr class="table-row">        <td class="table-cell table-primary">Alan Turing</td>        <td class="table-cell">Admin</td>        <td class="table-cell table-numeric">96</td>      </tr>      <tr class="table-row">        <td class="table-cell table-primary">Grace Hopper</td>        <td class="table-cell">Member</td>        <td class="table-cell table-numeric">1,204</td>      </tr>    </tbody>  </table></div>
<div className="sheet overflow-hidden">  <table className="table table-compact">    <thead>      <tr className="table-row">        <th className="table-heading" scope="col" aria-sort="ascending">          <button type="button" className="table-sort">Name</button>        </th>        <th className="table-heading" scope="col">Role</th>        <th className="table-heading table-numeric" scope="col">          <button type="button" className="table-sort">Deployments</button>        </th>      </tr>    </thead>    <tbody>      <tr className="table-row">        <td className="table-cell table-primary">Ada Lovelace</td>        <td className="table-cell">Owner</td>        <td className="table-cell table-numeric">412</td>      </tr>      <tr className="table-row">        <td className="table-cell table-primary">Alan Turing</td>        <td className="table-cell">Admin</td>        <td className="table-cell table-numeric">96</td>      </tr>      <tr className="table-row">        <td className="table-cell table-primary">Grace Hopper</td>        <td className="table-cell">Member</td>        <td className="table-cell table-numeric">1,204</td>      </tr>    </tbody>  </table></div>
<div class="sheet overflow-hidden">  <table class="table table-compact">    <thead>      <tr class="table-row">        <th class="table-heading" scope="col" aria-sort="ascending">          <button type="button" class="table-sort">Name</button>        </th>        <th class="table-heading" scope="col">Role</th>        <th class="table-heading table-numeric" scope="col">          <button type="button" class="table-sort">Deployments</button>        </th>      </tr>    </thead>    <tbody>      <tr class="table-row">        <td class="table-cell table-primary">Ada Lovelace</td>        <td class="table-cell">Owner</td>        <td class="table-cell table-numeric">412</td>      </tr>      <tr class="table-row">        <td class="table-cell table-primary">Alan Turing</td>        <td class="table-cell">Admin</td>        <td class="table-cell table-numeric">96</td>      </tr>      <tr class="table-row">        <td class="table-cell table-primary">Grace Hopper</td>        <td class="table-cell">Member</td>        <td class="table-cell table-numeric">1,204</td>      </tr>    </tbody>  </table></div>
<template>  <div class="sheet overflow-hidden">    <table class="table table-compact">      <thead>        <tr class="table-row">          <th class="table-heading" scope="col" aria-sort="ascending">            <button type="button" class="table-sort">Name</button>          </th>          <th class="table-heading" scope="col">Role</th>          <th class="table-heading table-numeric" scope="col">            <button type="button" class="table-sort">Deployments</button>          </th>        </tr>      </thead>      <tbody>        <tr class="table-row">          <td class="table-cell table-primary">Ada Lovelace</td>          <td class="table-cell">Owner</td>          <td class="table-cell table-numeric">412</td>        </tr>        <tr class="table-row">          <td class="table-cell table-primary">Alan Turing</td>          <td class="table-cell">Admin</td>          <td class="table-cell table-numeric">96</td>        </tr>        <tr class="table-row">          <td class="table-cell table-primary">Grace Hopper</td>          <td class="table-cell">Member</td>          <td class="table-cell table-numeric">1,204</td>        </tr>      </tbody>    </table>  </div></template>

table-compact は行を詰めて表示します。長い一覧にざっと目を通すときに適しています。

#行の選択と、開ける行

aria-selected="true" を指定した行は、一段浮き上がったシートとして表示します。テーブルに table-interactive を指定すると、メニュー の項目と同じように、テーブル本体のすべての行がチップと同じ色合いでポインターに反応します。どちらも行全体に適用されるため、セルの境界に継ぎ目が出ません。

選択

<div class="sheet overflow-hidden">  <table class="table table-interactive">    <thead>      <tr class="table-row">        <th class="table-heading" scope="col">          <input type="checkbox" class="checkbox" aria-label="Select all">        </th>        <th class="table-heading" scope="col">Domain</th>        <th class="table-heading" scope="col">Certificate</th>      </tr>    </thead>    <tbody>      <tr class="table-row" aria-selected="true">        <td class="table-cell">          <input type="checkbox" class="checkbox" checked aria-label="Select atlas.dev">        </td>        <td class="table-cell table-primary">atlas.dev</td>        <td class="table-cell">Renews in 61 days</td>      </tr>      <tr class="table-row">        <td class="table-cell">          <input type="checkbox" class="checkbox" aria-label="Select docs.atlas.dev">        </td>        <td class="table-cell table-primary">docs.atlas.dev</td>        <td class="table-cell">Renews in 12 days</td>      </tr>    </tbody>  </table></div>
<div className="sheet overflow-hidden">  <table className="table table-interactive">    <thead>      <tr className="table-row">        <th className="table-heading" scope="col">          <input type="checkbox" className="checkbox" aria-label="Select all" />        </th>        <th className="table-heading" scope="col">Domain</th>        <th className="table-heading" scope="col">Certificate</th>      </tr>    </thead>    <tbody>      <tr className="table-row" aria-selected="true">        <td className="table-cell">          <input type="checkbox" className="checkbox" defaultChecked aria-label="Select atlas.dev" />        </td>        <td className="table-cell table-primary">atlas.dev</td>        <td className="table-cell">Renews in 61 days</td>      </tr>      <tr className="table-row">        <td className="table-cell">          <input type="checkbox" className="checkbox" aria-label="Select docs.atlas.dev" />        </td>        <td className="table-cell table-primary">docs.atlas.dev</td>        <td className="table-cell">Renews in 12 days</td>      </tr>    </tbody>  </table></div>
<div class="sheet overflow-hidden">  <table class="table table-interactive">    <thead>      <tr class="table-row">        <th class="table-heading" scope="col">          <input type="checkbox" class="checkbox" aria-label="Select all">        </th>        <th class="table-heading" scope="col">Domain</th>        <th class="table-heading" scope="col">Certificate</th>      </tr>    </thead>    <tbody>      <tr class="table-row" aria-selected="true">        <td class="table-cell">          <input type="checkbox" class="checkbox" checked aria-label="Select atlas.dev">        </td>        <td class="table-cell table-primary">atlas.dev</td>        <td class="table-cell">Renews in 61 days</td>      </tr>      <tr class="table-row">        <td class="table-cell">          <input type="checkbox" class="checkbox" aria-label="Select docs.atlas.dev">        </td>        <td class="table-cell table-primary">docs.atlas.dev</td>        <td class="table-cell">Renews in 12 days</td>      </tr>    </tbody>  </table></div>
<template>  <div class="sheet overflow-hidden">    <table class="table table-interactive">      <thead>        <tr class="table-row">          <th class="table-heading" scope="col">            <input type="checkbox" class="checkbox" aria-label="Select all">          </th>          <th class="table-heading" scope="col">Domain</th>          <th class="table-heading" scope="col">Certificate</th>        </tr>      </thead>      <tbody>        <tr class="table-row" aria-selected="true">          <td class="table-cell">            <input type="checkbox" class="checkbox" checked aria-label="Select atlas.dev">          </td>          <td class="table-cell table-primary">atlas.dev</td>          <td class="table-cell">Renews in 61 days</td>        </tr>        <tr class="table-row">          <td class="table-cell">            <input type="checkbox" class="checkbox" aria-label="Select docs.atlas.dev">          </td>          <td class="table-cell table-primary">docs.atlas.dev</td>          <td class="table-cell">Renews in 12 days</td>        </tr>      </tbody>    </table>  </div></template>

#幅の広いテーブル

テーブルは列を保ちます。カードを縦に並べる形に変えると、同じ列の値を見比べられるというテーブルの利点が失われるためです。テーブルが配置先の列より広くなる場合は、インライン軸方向にスクロールする スクロール領域 で囲みます。画面外に列が続く側の端はフェードします。table-sticky を使うと、行をスクロールしても見出しが表示されたままになります。

幅の広いテーブル

656 px
<div class="sheet overflow-hidden">  <div class="scroll-area scroll-area-inline" tabindex="0" role="region" aria-label="Deployments">    <table class="table">      <thead>        <tr class="table-row">          <th class="table-heading" scope="col">Deployment</th>          <th class="table-heading" scope="col">Branch</th>          <th class="table-heading" scope="col">Commit</th>          <th class="table-heading" scope="col">Author</th>          <th class="table-heading table-numeric" scope="col">Duration</th>        </tr>      </thead>      <tbody>        <tr class="table-row">          <td class="table-cell table-primary whitespace-nowrap">atlas-9f2c1a</td>          <td class="table-cell whitespace-nowrap">main</td>          <td class="table-cell whitespace-nowrap">Soften every edge</td>          <td class="table-cell whitespace-nowrap">Ada Lovelace</td>          <td class="table-cell table-numeric">48s</td>        </tr>        <tr class="table-row">          <td class="table-cell table-primary whitespace-nowrap">atlas-71be0d</td>          <td class="table-cell whitespace-nowrap">feature/anchors</td>          <td class="table-cell whitespace-nowrap">Glide the segmented thumb</td>          <td class="table-cell whitespace-nowrap">Alan Turing</td>          <td class="table-cell table-numeric">1m 02s</td>        </tr>      </tbody>    </table>  </div></div>
<div className="sheet overflow-hidden">  <div className="scroll-area scroll-area-inline" tabIndex={0} role="region" aria-label="Deployments">    <table className="table">      <thead>        <tr className="table-row">          <th className="table-heading" scope="col">Deployment</th>          <th className="table-heading" scope="col">Branch</th>          <th className="table-heading" scope="col">Commit</th>          <th className="table-heading" scope="col">Author</th>          <th className="table-heading table-numeric" scope="col">Duration</th>        </tr>      </thead>      <tbody>        <tr className="table-row">          <td className="table-cell table-primary whitespace-nowrap">atlas-9f2c1a</td>          <td className="table-cell whitespace-nowrap">main</td>          <td className="table-cell whitespace-nowrap">Soften every edge</td>          <td className="table-cell whitespace-nowrap">Ada Lovelace</td>          <td className="table-cell table-numeric">48s</td>        </tr>        <tr className="table-row">          <td className="table-cell table-primary whitespace-nowrap">atlas-71be0d</td>          <td className="table-cell whitespace-nowrap">feature/anchors</td>          <td className="table-cell whitespace-nowrap">Glide the segmented thumb</td>          <td className="table-cell whitespace-nowrap">Alan Turing</td>          <td className="table-cell table-numeric">1m 02s</td>        </tr>      </tbody>    </table>  </div></div>
<div class="sheet overflow-hidden">  <div class="scroll-area scroll-area-inline" tabindex="0" role="region" aria-label="Deployments">    <table class="table">      <thead>        <tr class="table-row">          <th class="table-heading" scope="col">Deployment</th>          <th class="table-heading" scope="col">Branch</th>          <th class="table-heading" scope="col">Commit</th>          <th class="table-heading" scope="col">Author</th>          <th class="table-heading table-numeric" scope="col">Duration</th>        </tr>      </thead>      <tbody>        <tr class="table-row">          <td class="table-cell table-primary whitespace-nowrap">atlas-9f2c1a</td>          <td class="table-cell whitespace-nowrap">main</td>          <td class="table-cell whitespace-nowrap">Soften every edge</td>          <td class="table-cell whitespace-nowrap">Ada Lovelace</td>          <td class="table-cell table-numeric">48s</td>        </tr>        <tr class="table-row">          <td class="table-cell table-primary whitespace-nowrap">atlas-71be0d</td>          <td class="table-cell whitespace-nowrap">feature/anchors</td>          <td class="table-cell whitespace-nowrap">Glide the segmented thumb</td>          <td class="table-cell whitespace-nowrap">Alan Turing</td>          <td class="table-cell table-numeric">1m 02s</td>        </tr>      </tbody>    </table>  </div></div>
<template>  <div class="sheet overflow-hidden">    <div class="scroll-area scroll-area-inline" tabindex="0" role="region" aria-label="Deployments">      <table class="table">        <thead>          <tr class="table-row">            <th class="table-heading" scope="col">Deployment</th>            <th class="table-heading" scope="col">Branch</th>            <th class="table-heading" scope="col">Commit</th>            <th class="table-heading" scope="col">Author</th>            <th class="table-heading table-numeric" scope="col">Duration</th>          </tr>        </thead>        <tbody>          <tr class="table-row">            <td class="table-cell table-primary whitespace-nowrap">atlas-9f2c1a</td>            <td class="table-cell whitespace-nowrap">main</td>            <td class="table-cell whitespace-nowrap">Soften every edge</td>            <td class="table-cell whitespace-nowrap">Ada Lovelace</td>            <td class="table-cell table-numeric">48s</td>          </tr>          <tr class="table-row">            <td class="table-cell table-primary whitespace-nowrap">atlas-71be0d</td>            <td class="table-cell whitespace-nowrap">feature/anchors</td>            <td class="table-cell whitespace-nowrap">Glide the segmented thumb</td>            <td class="table-cell whitespace-nowrap">Alan Turing</td>            <td class="table-cell table-numeric">1m 02s</td>          </tr>        </tbody>      </table>    </div>  </div></template>
プレビューの幅を狭めると、テーブルはシート内でスクロールできるようになり、末尾側の端がフェードします。

#アクセシビリティ

  • 各セルが列見出しとともに読み上げられるように、ネイティブの <table> 内に <thead> と <tbody> を使い、列見出しに scope="col" を指定します。
  • キーボードでスクロールできるよう、スクロール領域のラッパーには tabindex="0" と role="region" を指定し、ラベルを付けます。
  • 選択状態は、行の aria-selected とチェックボックスの状態の両方で、意図的に伝えます。

#クラス

クラス説明
tableネイティブのテーブル、またはロールで構成したグリッド
table-row行
table-heading列見出し。控えめなキャプションと、データ行よりはっきりした罫線
table-cellインライン方向の始端に揃えたデータセルまたは行見出しです。ネイティブの scope=row/rowgroup または role=rowheader を使う場合は、ブラウザー既定の太字に代えて、テーマのコントロール用フォントウェイトを適用します。
table-sort並べ替え可能な見出しの中で順序を変えるボタンです。ポインターが重なると見出しの語句がチップの上に表示され、並べ替え済みの列のシェブロンを含みます。
table-titlecaption に適用する表の名前です。見出しの上、開始側の端にそろえたタイトルになります。
table-primary行を識別するセルです。強調用の前景色で表示します。table-cell と併用します
table-numeric見出しまたはセルに使う右揃えの等幅数字table-heading または table-cell と併用します
table-compact流し読みする長いリスト向けの、間隔を詰めた行table と併用します
table-interactiveセルを含む行はポインター操作に反応し、フォーカスリングを表示table と併用します
table-stickyデータ行をスクロールしても、見出しは表示されたままです。table と併用します

#カスタムプロパティ

プロパティ既定値説明
--table-padding-x1rem見出しとセルのインライン方向のパディング。コンパクトなテーブルでは .75rem
--table-padding-y.75remセルのブロック方向のパディング。コンパクトなテーブルでは .4375rem

#ソース

@master/ui/components/table.css
/* * Table: rows of data on hairlines. Every part is reached by class, so the same styles serve a native <table> * and a grid of roles. Headings are quiet captions; a sortable heading shows its direction from aria-sort; * numbers line up on tabular figures. Put the table in a sheet for a surface and in a scroll area when it can * be wider than its column. */@layer components.ui {  .table {    --table-padding-x: 1rem;    --table-padding-y: .75rem;    display: table;    width: 100%;    border-spacing: 0;    border-collapse: separate;    color: var(--color-text-body);    font-size: .875rem;    line-height: 1.45;    text-align: start;    /* Denser rows, for long lists read by scanning. */    &.table-compact {      --table-padding-x: .75rem;      --table-padding-y: .4375rem;      font-size: .8125rem;    }  }  /* A column heading: a quiet caption on a firmer rule than the rows below it. */  .table-heading {    /* The chevron of a sorted column, and how far it turns: none points down, ascending turns it up. */    --table-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3.5L10.3586 7.8586A0.2 0.2 0 0 1 10.3586 8.1414L6 12.5' transform='rotate(90 8 8)'/%3E%3C/svg%3E");    --table-chevron-turn: none;    display: table-cell;    padding: .625rem var(--table-padding-x);    border-block-end: 1px solid var(--color-line-divider);    color: var(--color-text-muted);    font-size: .75rem;    font-weight: var(--font-weight-control);    text-align: start;    white-space: nowrap;    vertical-align: bottom;    /* Sorted: the heading takes strong ink and a chevron that points the way the values run. */    &:is([aria-sort="ascending"], [aria-sort="descending"]) {      color: var(--color-text-strong);    }    &[aria-sort="ascending"] {      --table-chevron-turn: x 180deg;    }    @media (forced-colors: active) {      border-block-end-color: CanvasText;    }  }  /*   * The chevron follows the label, and leads it on a numeric column, so the label keeps the end edge its   * figures stand on. With a sort button in the heading the chevron is the button's, pressed with the label.   */  /*   * A heading that sorts keeps the chevron's room while it is not the sorted one, so sorting a column whose   * heading is its widest cell does not widen it and move the columns beside it.   */  .table-heading:not(.table-numeric) .table-sort::after, .table-heading.table-numeric .table-sort::before {    content: '';    display: inline-block;    flex: none;    width: .75rem;    height: .75rem;    visibility: hidden;  }  .table-heading:not(.table-numeric) .table-sort::after {    margin-inline-start: .25rem;  }  .table-heading.table-numeric .table-sort::before {    margin-inline-end: .25rem;  }  .table-heading:is([aria-sort="ascending"], [aria-sort="descending"]) {    &:not(.table-numeric, :has(.table-sort))::after,    &.table-numeric:not(:has(.table-sort))::before,    &:not(.table-numeric) .table-sort::after,    &.table-numeric .table-sort::before {      content: '';      display: inline-block;      flex: none;      width: .75rem;      height: .75rem;      background: currentColor;      mask: var(--table-chevron) center / contain no-repeat;      rotate: var(--table-chevron-turn);      vertical-align: -.125em;      visibility: visible;      /* As heavy as the chevron's own rule, so the system color wins over the forced current color. */      @media (forced-colors: active) {        background: CanvasText;        forced-color-adjust: none;      }    }    &:not(.table-numeric, :has(.table-sort))::after, &:not(.table-numeric) .table-sort::after {      margin-inline-start: .25rem;    }    &.table-numeric:not(:has(.table-sort))::before, &.table-numeric .table-sort::before {      margin-inline-end: .25rem;    }  }  /*   * A button in a heading that changes the order: the heading's own words, which sit on a chip under the pointer.   * It reaches 4px and 6px past its words, so they stay where a heading without one has them.   */  .table-sort {    position: relative;    display: inline-flex;    align-items: center;    margin: -.25rem -.375rem;    padding: .25rem .375rem;    border: 0;    border-radius: calc(var(--radius-chip) * var(--corner-scale));    corner-shape: var(--corner-shape);    background: transparent;    color: inherit;    font: inherit;    font-feature-settings: inherit;    letter-spacing: inherit;    text-align: inherit;    white-space: inherit;    appearance: none;    cursor: pointer;    user-select: none;    -webkit-user-select: none;    touch-action: manipulation;    -webkit-tap-highlight-color: transparent;    @media (hover: hover) {      &:hover {        background: var(--color-surface-chip);        color: var(--color-text-strong);      }    }    /* Pressed: a step deeper than the pointer's tone, so a tap is answered where there is no pointer. */    &:active {      background: var(--color-surface-inset-hover);      color: var(--color-text-strong);    }    &:focus-visible {      @apply --focus-ring;      outline-offset: 0;    }  }  /*   * Headings stand a column's padding apart, so on touch the button's target reaches 44px above and below only,   * on whichever of its pseudo-elements the chevron leaves free.   */  @media (pointer: coarse) {    .table-heading:not(.table-numeric) .table-sort::before {      @apply --touch-target-block;    }    .table-heading.table-numeric .table-sort::after {      @apply --touch-target-block;    }  }  /* The table's name, on a <caption>: a title at the start edge over the headings, not the browser's centered line. */  .table-title {    display: table-caption;    caption-side: top;    padding: .875rem var(--table-padding-x) .375rem;    color: var(--color-text-strong);    font-size: .875rem;    font-weight: var(--font-weight-control);    line-height: 1.4;    text-align: start;    text-wrap: balance;  }  .table-cell {    display: table-cell;    padding: var(--table-padding-y) var(--table-padding-x);    border-block-end: 1px solid var(--color-line-hair);    vertical-align: middle;    font-variant-numeric: tabular-nums;    font-weight: inherit;    text-align: start;    /* Native row headers must not fall back to the browser's centered, bold <th>. */    &:is([scope="row"], [scope="rowgroup"], [role="rowheader"]) {      font-weight: var(--font-weight-control);    }    @media (forced-colors: active) {      border-block-end-color: GrayText;    }  }  /* Numbers and amounts: on the end edge, in figures of one width, so digits stack in columns. */  .table-heading.table-numeric, .table-cell.table-numeric {    font-variant-numeric: tabular-nums;    text-align: end;  }  /* The identifying cell of a row, in strong ink. */  .table-cell.table-primary {    color: var(--color-text-strong);  }  /* The last row of a body that another body or a foot follows is not the table's last: its line stays. */  .table :not(:last-child) .table-row:last-child .table-cell {    border-block-end-color: var(--color-line-hair);  }  .table-row {    display: table-row;    /* The last row ends the table; the surface around it draws the edge. */    &:last-child .table-cell {      border-block-end-color: transparent;    }    /*     * A selected row rises one step as a sheet, so it reads apart from the pointer's tone. The row paints it,     * not its cells, so no seam shows where two cells meet. Say it with aria-selected as well as with its checkbox.     */    &[aria-selected="true"] {      @apply --surface-sheet;      box-shadow: var(--shadow-raised);      /* Forced colors take the tone away; an outline inside the row keeps it chosen. */      @media (forced-colors: active) {        outline: 2px solid Highlight;        outline-offset: -2px;      }    }  }  /* Rows that can be opened or selected answer the pointer at once, like rows in a menu. */  .table-interactive .table-row {    /* The pressed tone answers a tap, so the browser's own grey flash would only double it. */    -webkit-tap-highlight-color: transparent;    /* The pointer's tone leaves a selected row alone: hover is a tone, selected is a sheet. */    @media (hover: hover) {      &:hover:has(.table-cell):not([aria-selected="true"]) {        background: var(--color-surface-chip);      }    }    /* Pressed: a step deeper than the pointer's tone. */    &:active:has(.table-cell):not([aria-selected="true"]) {      background: var(--color-surface-inset-hover);    }    &:focus-visible {      outline: 2px solid var(--color-focus);      outline-offset: -2px;    }    /* A row that is pressed is a touch target: a compact one grows to 44px on touch, as a list's rows do. */    @media (pointer: coarse) {      &:has(.table-cell) {        height: 2.75rem;      }    }  }  /* Headings stay in view while the rows scroll under them, on the color of the surface they sit on. */  .table-sticky .table-heading {    position: sticky;    inset-block-start: 0;    z-index: 1;    background: var(--surface-color, var(--color-surface-base));  }  /* A row or a cell the keys bring into view stops below the headings that stand over the rows, not under them. */  .table-sticky :is(.table-row, .table-cell) {    scroll-margin-block-start: 2.5rem;  }}