ナビゲーション

v2.1.0
データ表示

タイムライン

イベントを発生順に 1 本の線上に表示します。アクティビティフィード、履歴、変更履歴などに。

このページの内容

タイムラインは、イベントを発生順に 1 本の線に沿って並べる順序付きリストです。アクティビティフィード、デプロイ履歴、変更履歴などに使います。各イベントのマーカーを縦一列に配置し、その横にテキストを置きます。マーカー同士は細い線でつながります。

タイムライン

<ol class="timeline max-w(360) mx-auto">  <li class="timeline-item" aria-current="true">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Deployed to production</p>      <p class="timeline-description">atlas.dev is live in 14 regions.</p>      <time class="timeline-time" datetime="2026-11-11T09:42Z">2 minutes ago</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Build completed</p>      <p class="timeline-description">38 routes compiled in 48 seconds.</p>      <time class="timeline-time" datetime="2026-11-11T09:41Z">3 minutes ago</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Commit pushed to main</p>      <time class="timeline-time" datetime="2026-11-11T09:40Z">4 minutes ago</time>    </div>  </li></ol>
<ol className="timeline max-w(360) mx-auto">  <li className="timeline-item" aria-current="true">    <span className="timeline-marker"></span>    <div className="timeline-body">      <p className="timeline-title">Deployed to production</p>      <p className="timeline-description">atlas.dev is live in 14 regions.</p>      <time className="timeline-time" dateTime="2026-11-11T09:42Z">2 minutes ago</time>    </div>  </li>  <li className="timeline-item">    <span className="timeline-marker"></span>    <div className="timeline-body">      <p className="timeline-title">Build completed</p>      <p className="timeline-description">38 routes compiled in 48 seconds.</p>      <time className="timeline-time" dateTime="2026-11-11T09:41Z">3 minutes ago</time>    </div>  </li>  <li className="timeline-item">    <span className="timeline-marker"></span>    <div className="timeline-body">      <p className="timeline-title">Commit pushed to main</p>      <time className="timeline-time" dateTime="2026-11-11T09:40Z">4 minutes ago</time>    </div>  </li></ol>
<ol class="timeline max-w(360) mx-auto">  <li class="timeline-item" aria-current="true">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Deployed to production</p>      <p class="timeline-description">atlas.dev is live in 14 regions.</p>      <time class="timeline-time" datetime="2026-11-11T09:42Z">2 minutes ago</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Build completed</p>      <p class="timeline-description">38 routes compiled in 48 seconds.</p>      <time class="timeline-time" datetime="2026-11-11T09:41Z">3 minutes ago</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Commit pushed to main</p>      <time class="timeline-time" datetime="2026-11-11T09:40Z">4 minutes ago</time>    </div>  </li></ol>
<template>  <ol class="timeline max-w(360) mx-auto">    <li class="timeline-item" aria-current="true">      <span class="timeline-marker"></span>      <div class="timeline-body">        <p class="timeline-title">Deployed to production</p>        <p class="timeline-description">atlas.dev is live in 14 regions.</p>        <time class="timeline-time" datetime="2026-11-11T09:42Z">2 minutes ago</time>      </div>    </li>    <li class="timeline-item">      <span class="timeline-marker"></span>      <div class="timeline-body">        <p class="timeline-title">Build completed</p>        <p class="timeline-description">38 routes compiled in 48 seconds.</p>        <time class="timeline-time" datetime="2026-11-11T09:41Z">3 minutes ago</time>      </div>    </li>    <li class="timeline-item">      <span class="timeline-marker"></span>      <div class="timeline-body">        <p class="timeline-title">Commit pushed to main</p>        <time class="timeline-time" datetime="2026-11-11T09:40Z">4 minutes ago</time>      </div>    </li>  </ol></template>

#マーカー

空の timeline-marker は小さな点になります。最新のイベントや閲覧中のイベントに aria-current を付けると、マーカーが前景色になり、周囲に淡い縁取りが付きます。icon を入れたマーカーには、その周りに小さなくぼみが付きます。どちらの形にするかは :has() が判定するため、同じフィードで両方を使えます。

アイコン付き

<ol class="timeline max-w(360) mx-auto">  <li class="timeline-item">    <span class="timeline-marker">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5" />      </svg>    </span>    <div class="timeline-body">      <p class="timeline-title">Ada approved the change</p>      <time class="timeline-time">Today at 09:12</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker">      <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M3.5 2.5L12.5 2.5A1 1 0 0 1 13.5 3.5L13.5 10A1 1 0 0 1 12.5 11L7.777 11A1 1 0 0 0 7.2625 11.1425L4.0145 13.0913A1 1 0 0 1 2.5 12.2338L2.5 3.5A1 1 0 0 1 3.5 2.5Z" />      </svg>    </span>    <div class="timeline-body">      <p class="timeline-title">Alan left a comment</p>      <p class="timeline-description">The focus ring is cut by the mask. Move it to the group.</p>      <time class="timeline-time">Yesterday at 17:40</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Pull request opened</p>      <time class="timeline-time">Yesterday at 16:05</time>    </div>  </li></ol>
import CheckIcon from '@master/icons-react/native/16/soft/check'import MessageIcon from '@master/icons-react/native/16/soft/message'<ol className="timeline max-w(360) mx-auto">  <li className="timeline-item">    <span className="timeline-marker"><CheckIcon className="icon" /></span>    <div className="timeline-body">      <p className="timeline-title">Ada approved the change</p>      <time className="timeline-time">Today at 09:12</time>    </div>  </li>  <li className="timeline-item">    <span className="timeline-marker"><MessageIcon className="icon" /></span>    <div className="timeline-body">      <p className="timeline-title">Alan left a comment</p>      <p className="timeline-description">        The focus ring is cut by the mask. Move it to the group.      </p>      <time className="timeline-time">Yesterday at 17:40</time>    </div>  </li>  <li className="timeline-item">    <span className="timeline-marker"></span>    <div className="timeline-body">      <p className="timeline-title">Pull request opened</p>      <time className="timeline-time">Yesterday at 16:05</time>    </div>  </li></ol>
<script>  import CheckIcon from '@master/icons-svelte/native/16/soft/check'  import MessageIcon from '@master/icons-svelte/native/16/soft/message'</script><ol class="timeline max-w(360) mx-auto">  <li class="timeline-item">    <span class="timeline-marker"><CheckIcon class="icon" /></span>    <div class="timeline-body">      <p class="timeline-title">Ada approved the change</p>      <time class="timeline-time">Today at 09:12</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker"><MessageIcon class="icon" /></span>    <div class="timeline-body">      <p class="timeline-title">Alan left a comment</p>      <p class="timeline-description">The focus ring is cut by the mask. Move it to the group.</p>      <time class="timeline-time">Yesterday at 17:40</time>    </div>  </li>  <li class="timeline-item">    <span class="timeline-marker"></span>    <div class="timeline-body">      <p class="timeline-title">Pull request opened</p>      <time class="timeline-time">Yesterday at 16:05</time>    </div>  </li></ol>
<script setup>import CheckIcon from '@master/icons-vue/native/16/soft/check'import MessageIcon from '@master/icons-vue/native/16/soft/message'</script><template>  <ol class="timeline max-w(360) mx-auto">    <li class="timeline-item">      <span class="timeline-marker"><CheckIcon class="icon" /></span>      <div class="timeline-body">        <p class="timeline-title">Ada approved the change</p>        <time class="timeline-time">Today at 09:12</time>      </div>    </li>    <li class="timeline-item">      <span class="timeline-marker"><MessageIcon class="icon" /></span>      <div class="timeline-body">        <p class="timeline-title">Alan left a comment</p>        <p class="timeline-description">The focus ring is cut by the mask. Move it to the group.</p>        <time class="timeline-time">Yesterday at 17:40</time>      </div>    </li>    <li class="timeline-item">      <span class="timeline-marker"></span>      <div class="timeline-body">        <p class="timeline-title">Pull request opened</p>        <time class="timeline-time">Yesterday at 16:05</time>      </div>    </li>  </ol></template>

#タイムラインとステップの使い分け

タイムラインは、すでに起きたイベントを記録し、新しいイベントが起きるたびに項目が増えていきます。ステップは、ユーザーが決まった順序で進む手順を示し、現在のステップとこれからのステップがわかります。進行中の処理を示すにはトレースを使います。実行中や失敗したステップもあり、各ステップを展開して詳細を確認できます。

#アクセシビリティ

  • 通常は順序に意味があるため、<ol> を使います。各時点には <time> を使い、datetime を指定します。
  • マーカーと線はスタイルシートで描画され、読み上げの対象外です。マーカー内のアイコンは装飾なので、何が起きたかはタイトルに記載します。
  • 画面に表示されている間に更新されるフィードは、aria-live="polite" を指定したライブリージョンにします。

#クラス

クラス説明
timelineリスト
timeline-itemイベント。極細線でマーカーを次のイベントのマーカーにつなぐ
timeline-marker中身が空なら小さな点、アイコンがあればそれを囲む小さなくぼみ
timeline-bodyマーカーの横の文言
timeline-title発生した内容を強調前景色で表示
timeline-descriptionより控えめに表示する詳細の 1 行
timeline-time発生時刻を等幅数字で表示

#カスタムプロパティ

プロパティ既定値説明
--timeline-marker1.5remマーカー列の幅

#ソース

@master/ui/components/timeline.css
/* * Timeline: events in the order they happened, as a list on one line. * Each event has a marker on a column and its words beside it; a hairline joins the markers. A bare marker * is a small dot, and a marker that holds an icon becomes a small well around it. */@layer components.ui {  .timeline {    --timeline-marker: 1.5rem;    display: flex;    flex-direction: column;    min-width: 0;    margin: 0;    padding: 0;    color: var(--color-text-body);    font-size: .875rem;    line-height: 1.5;    list-style: none;  }  .timeline-item {    position: relative;    display: flex;    align-items: flex-start;    gap: .75rem;    min-width: 0;    padding-block-end: 1.25rem;    &:last-child {      padding-block-end: 0;    }    /*     * The line runs from under this marker to the next one, 2px clear of each. A marker sits centered on the     * first line, (1lh - --timeline-marker) / 2 from the item's top, so both ends are counted from there.     */    &:not(:last-child)::before {      content: '';      position: absolute;      inset-block: calc((1lh + var(--timeline-marker)) / 2 + .125rem) calc(.125rem - (1lh - var(--timeline-marker)) / 2);      inset-inline-start: calc(var(--timeline-marker) / 2 - .5px);      width: 1px;      background: var(--color-line-divider);    }    @media (forced-colors: active) {      &:not(:last-child)::before {        background: CanvasText;      }    }  }  /* The marker's column is as tall as the first line of text, so the dot sits on that line. */  .timeline-marker {    --icon-size: .875rem;    --icon-color: var(--color-text-muted);    display: grid;    flex: none;    place-items: center;    width: var(--timeline-marker);    height: var(--timeline-marker);    margin-block: calc((1lh - var(--timeline-marker)) / 2);    border-radius: 999px;    /* Bare: a dot. */    &:empty::before {      content: '';      width: .4375rem;      height: .4375rem;      border-radius: 999px;      background: var(--color-line-mark);    }    /* With an icon: a small well around it. */    &:has(.icon) {      background: var(--color-surface-inset);      box-shadow: var(--shadow-pressed);    }    @media (forced-colors: active) {      &:empty::before {        background: CanvasText;      }      &:has(.icon) {        outline: 1px solid CanvasText;        outline-offset: -1px;      }    }  }  /* The newest or current event: its dot takes ink. */  .timeline-item[aria-current]:not([aria-current="false"]) .timeline-marker:empty::before {    background: var(--color-text-strong);    box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-text-strong) 12%, transparent);    /* A color that is not a system color would turn to Canvas here and the dot would vanish. */    @media (forced-colors: active) {      background: Highlight;    }  }  .timeline-body {    display: grid;    flex: 1 1 0;    gap: .125rem;    min-width: 0;  }  .timeline-title {    margin: 0;    color: var(--color-text-strong);    font-weight: var(--font-weight-control);    text-wrap: balance;    overflow-wrap: anywhere;  }  .timeline-description {    margin: 0;    color: var(--color-text-muted);    font-size: .8125rem;    text-wrap: pretty;    overflow-wrap: anywhere;  }  /* When it happened: a quiet line in tabular figures. */  .timeline-time {    margin: 0;    color: var(--color-text-muted);    font-size: .75rem;    font-variant-numeric: tabular-nums;  }}