ナビゲーション

v2.1.0
タイポグラフィ

箇条書き

マーカーを専用の列に配置する、本文中のリストです。

このページの内容

箇条書きは、記事の要点、プランに含まれる内容、文章で記述した手順などを本文中に並べるリストです。マーカーは専用の列で各項目の 1 行目にそろうため、テキストが折り返しても、すべての項目の開始位置がそろいます。HTML 標準の <ul> または <ol> を使います。

箇条書き

<ul class="bullets max-w(420) mx-auto">  <li class="bullets-item">Every overlay is a native element, opened without script.</li>  <li class="bullets-item">    Tokens retune every component, and a theme is a file of them that selects no component.  </li>  <li class="bullets-item">Each stylesheet has a contract beside it that says what it promises.</li></ul>
<ul className="bullets max-w(420) mx-auto">  <li className="bullets-item">Every overlay is a native element, opened without script.</li>  <li className="bullets-item">    Tokens retune every component, and a theme is a file of them that selects no component.  </li>  <li className="bullets-item">    Each stylesheet has a contract beside it that says what it promises.  </li></ul>
<ul class="bullets max-w(420) mx-auto">  <li class="bullets-item">Every overlay is a native element, opened without script.</li>  <li class="bullets-item">    Tokens retune every component, and a theme is a file of them that selects no component.  </li>  <li class="bullets-item">Each stylesheet has a contract beside it that says what it promises.</li></ul>
<template>  <ul class="bullets max-w(420) mx-auto">    <li class="bullets-item">Every overlay is a native element, opened without script.</li>    <li class="bullets-item">      Tokens retune every component, and a theme is a file of them that selects no component.    </li>    <li class="bullets-item">      Each stylesheet has a contract beside it that says what it promises.    </li>  </ul></template>

#マーカー

既定のマーカーは小さな点です。リストに次のいずれかのクラスを指定すると、マーカーを変更できます。

  • bullets-check は、プランに含まれる機能やリリースで追加された項目などに、本文と同じ色のチェックマークを表示します。
  • bullets-numbered は、各項目の番号を等幅数字で表示し、マーカー列の末尾にそろえます。9 から 10 に桁が増えても、番号の末尾はそろいます。順序に意味がある <ol> に使います。

チェック付きリストと番号付きリスト

<ul class="bullets bullets-check w(220)">  <li class="bullets-item">Unlimited projects</li>  <li class="bullets-item">Custom domains, with certificates issued and renewed for you</li>  <li class="bullets-item">Preview for every branch</li></ul><ol class="bullets bullets-numbered w(220)">  <li class="bullets-item">Install the package.</li>  <li class="bullets-item">Import the stylesheet after the preset.</li>  <li class="bullets-item">Write the markup.</li></ol>
<>  <ul className="bullets bullets-check w(220)">    <li className="bullets-item">Unlimited projects</li>    <li className="bullets-item">Custom domains, with certificates issued and renewed for you</li>    <li className="bullets-item">Preview for every branch</li>  </ul>  <ol className="bullets bullets-numbered w(220)">    <li className="bullets-item">Install the package.</li>    <li className="bullets-item">Import the stylesheet after the preset.</li>    <li className="bullets-item">Write the markup.</li>  </ol></>
<ul class="bullets bullets-check w(220)">  <li class="bullets-item">Unlimited projects</li>  <li class="bullets-item">Custom domains, with certificates issued and renewed for you</li>  <li class="bullets-item">Preview for every branch</li></ul><ol class="bullets bullets-numbered w(220)">  <li class="bullets-item">Install the package.</li>  <li class="bullets-item">Import the stylesheet after the preset.</li>  <li class="bullets-item">Write the markup.</li></ol>
<template>  <ul class="bullets bullets-check w(220)">    <li class="bullets-item">Unlimited projects</li>    <li class="bullets-item">Custom domains, with certificates issued and renewed for you</li>    <li class="bullets-item">Preview for every branch</li>  </ul>  <ol class="bullets bullets-numbered w(220)">    <li class="bullets-item">Install the package.</li>    <li class="bullets-item">Import the stylesheet after the preset.</li>    <li class="bullets-item">Write the markup.</li>  </ol></template>

#対象外の項目

プランの内容を示す一覧では、何が含まれないかも判断材料になります。項目に bullets-off を指定すると、マーカーが短いダッシュになり、文字色も一段控えめになります。ダッシュや文字色が見えない読者にも同じ情報が伝わるように、例のように sr-only ユーティリティで視覚的に非表示にした span を項目の先頭に置き、「対象外」などの文言を入れます。

対象外

<div class="card w-full max-w(300)">  <div class="card-header">    <h3 class="card-title">Starter</h3>    <p class="card-description">For one person and a few projects.</p>  </div>  <ul class="bullets bullets-check">    <li class="bullets-item">Three projects</li>    <li class="bullets-item">Custom domains</li>    <li class="bullets-item bullets-off">      <span class="sr-only">Not included:</span>Single sign-on    </li>    <li class="bullets-item bullets-off"><span class="sr-only">Not included:</span>Audit log</li>  </ul></div>
<div className="card w-full max-w(300)">  <div className="card-header">    <h3 className="card-title">Starter</h3>    <p className="card-description">For one person and a few projects.</p>  </div>  <ul className="bullets bullets-check">    <li className="bullets-item">Three projects</li>    <li className="bullets-item">Custom domains</li>    <li className="bullets-item bullets-off">      <span className="sr-only">Not included:</span>Single sign-on    </li>    <li className="bullets-item bullets-off">      <span className="sr-only">Not included:</span>Audit log    </li>  </ul></div>
<div class="card w-full max-w(300)">  <div class="card-header">    <h3 class="card-title">Starter</h3>    <p class="card-description">For one person and a few projects.</p>  </div>  <ul class="bullets bullets-check">    <li class="bullets-item">Three projects</li>    <li class="bullets-item">Custom domains</li>    <li class="bullets-item bullets-off">      <span class="sr-only">Not included:</span>Single sign-on    </li>    <li class="bullets-item bullets-off"><span class="sr-only">Not included:</span>Audit log</li>  </ul></div>
<template>  <div class="card w-full max-w(300)">    <div class="card-header">      <h3 class="card-title">Starter</h3>      <p class="card-description">For one person and a few projects.</p>    </div>    <ul class="bullets bullets-check">      <li class="bullets-item">Three projects</li>      <li class="bullets-item">Custom domains</li>      <li class="bullets-item bullets-off">        <span class="sr-only">Not included:</span>Single sign-on      </li>      <li class="bullets-item bullets-off"><span class="sr-only">Not included:</span>Audit log</li>    </ul>  </div></template>

#入れ子と余白

項目内の bullets リストは、親項目の本文の開始位置にそろえてインデントし、その本文から 8px 下に配置します。項目間の間隔は --bullets-gap で指定し、既定では 8px です。--bullets-marker はマーカー列の幅です。リストは周囲のテキストの文字サイズ、行の高さ、文字色を引き継ぎ、マーカーは各項目の先頭行に揃います。同じリストを 14px のカードでも 17px の記事でも使え、インク色の面ではマーカーの色も文字色に合わせて切り替わります。

#箇条書き、リスト、チェックリスト

箇条書きには文章を並べます。各行にメディア、タイトル、末尾の要素がある項目の集まりには リスト を使います。読者が済んだ項目にチェックを入れるなら チェックリスト、用語と値の組み合わせには データリスト を使います。

#アクセシビリティ

  • <ul> を使い、順序に意味がある場合は <ol> を使います。各項目には <li> を使います。マーカーはスタイルシートで描画され、読み上げられるのはリストであることと項目数です。
  • Safari で VoiceOver を使う場合、マーカーを取り除いたリストは role="list" を指定したときにリストとして読み上げられます。項目数が内容の理解に必要な場合は、この属性を追加します。
  • チェックマークの「含まれる」とダッシュの「含まれない」は、見た目でしか伝わりません。含まれない項目には、その旨をテキストで明記します。

#クラス

クラス説明
bullets項目間の間隔は 8px です。各項目には、テキストから 10px 離れた幅 16px の列に小さなドットを置きます。配置先のテキストのインク色を引き継ぐため、カード上でもインク色の面でも読み取れます。
bullets-check含まれる項目には、ドットの代わりに本文と同じインク色のチェックマークを表示します。bullets と併用します
bullets-numbered各項目の番号を等幅数字で表示し、マーカー列の末尾に揃えます。ol に適用します。bullets と併用します
bullets-itemリストの1項目です。マーカーを1行目に置き、テキストの開始位置をほかの項目と揃えます。
bullets-off含まれない項目です。通常のマーカーを短いダッシュに置き換え、テキストを控えめに表示します。bullets-item と併用します

#カスタムプロパティ

プロパティ既定値説明
--bullets-marker1remマーカー列の幅
--bullets-gap.5rem項目同士の間隔

#ソース

@master/ui/components/bullets.css
/* * Bullets: a list in running text, with its markers hung in a column of their own. * The list and its markers take the ink of the text they stand in, so it reads on a page, a card and an ink * surface alike. A marker is a small dot; with bullets-check it is a check, for what is included; with * bullets-numbered each item counts itself in tabular figures. The marker stands on the first line of its * item, however the text wraps, and the text of every item starts on one edge. * An item that is bullets-off is what is not included: a short dash in place of its marker and quieter words. * Say so in words as well, for a reader who sees neither. * Geometry: a 16px marker column, 10px from the text, and 8px between items. */@layer components.ui {  .bullets {    --bullets-marker: 1rem;    --bullets-gap: .5rem;    display: grid;    gap: var(--bullets-gap);    min-width: 0;    margin: 0;    padding: 0;    list-style: none;    counter-reset: bullets;    /* A list inside an item stands a little apart from the words over it. */    & & {      margin-block-start: var(--bullets-gap);    }    /* Included: a check. */    &.bullets-check .bullets-item::before {      width: .875rem;      height: .875rem;      margin-block: calc((1lh - .875rem) / 2);      border-radius: 0;      background: currentColor;      mask: 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='M3 8L6.3532 11.3532A0.2 0.2 0 0 0 6.6412 11.3479L13 4.5'/%3E%3C/svg%3E") center / contain no-repeat;    }    /* Counted: the item's number, set to the end of the marker column so the figures line up on their points. */    &.bullets-numbered {      --bullets-marker: 1.25rem;      .bullets-item::before {        content: counter(bullets) '.';        width: var(--bullets-marker);        height: auto;        margin: 0;        border-radius: 0;        background: none;        /* Inside an item of a checked list the figures would be painted through the check's mask. */        mask: none;        /* Quieter than the words, and still 4.5:1 where the words are the body ink. */        color: color-mix(in oklab, currentColor 78%, transparent);        font-variant-numeric: tabular-nums;        text-align: end;      }    }    @media (forced-colors: active) {      &.bullets-check .bullets-item::before {        background: CanvasText;      }    }  }  /* One item: the marker in its column, the words beside it. */  .bullets-item {    position: relative;    min-width: 0;    margin: 0;    padding: 0;    padding-inline-start: calc(var(--bullets-marker) + .625rem);    text-wrap: pretty;    overflow-wrap: anywhere;    counter-increment: bullets;    /* The marker: a dot at the middle of the first line. */    &::before {      content: '';      position: absolute;      inset-block-start: 0;      inset-inline-start: calc((var(--bullets-marker) - .3125rem) / 2);      width: .3125rem;      height: .3125rem;      margin-block: calc((1lh - .3125rem) / 2);      border-radius: 999px;      background: color-mix(in oklab, currentColor 45%, transparent);    }    @media (forced-colors: active) {      &::before {        background: CanvasText;      }    }  }  .bullets-check .bullets-item::before, .bullets-numbered .bullets-item::before {    inset-inline-start: 0;  }  /*   * Not included: a dash where the marker was, and quieter words. They are still words to read: at 78% of the body   * ink they keep 4.5:1 on a raised face in both themes, where 62% fell to about 3.3:1.   */  .bullets .bullets-item.bullets-off {    color: color-mix(in oklab, currentColor 78%, transparent);    &::before {      content: '';      inset-inline-start: calc((var(--bullets-marker) - .5rem) / 2);      width: .5rem;      height: 1.5px;      margin-block: calc((1lh - 1.5px) / 2);      border-radius: 999px;      background: currentColor;      mask: none;    }    /* The dash's current color would be forced to the canvas and vanish: it takes the quiet system color. */    @media (forced-colors: active) {      &::before {        background: GrayText;      }    }  }}