ナビゲーション

v2.1.0
アプリケーションのブロック

空の状態ブロック

表示する内容がまだないときに、ビューに何を表示し、最初の操作をどう案内するか。

空の状態とは、表示する項目がまだないときにビューに表示する内容です。空の状態コンポーネントに状況に合った文言を入れる、最も小さなブロックです。ここでは文言が要になります。何が表示される場所なのか、なぜ空なのか、次に何をすればよいのかを伝えます。

空の状態

<section class="sheet container-inline" aria-labelledby="es-title">  <div class="empty">    <div class="icon-frame empty-media" aria-hidden="true">      <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <path d="M2.5 15.25L2.5 5.25A1.25 1.25 0 0 1 3.75 4L7.9822 4A1.25 1.25 0 0 1 8.8661 4.3661L10.1339 5.6339A1.25 1.25 0 0 0 11.0178 6L16.25 6A1.25 1.25 0 0 1 17.5 7.25L17.5 15.25A1.25 1.25 0 0 1 16.25 16.5L3.75 16.5A1.25 1.25 0 0 1 2.5 15.25Z" />      </svg>    </div>    <h2 class="empty-title" id="es-title">No projects yet</h2>    <p class="empty-description">      A project connects a repository to an address. Create one, and every push becomes a deployment.    </p>    <div class="empty-actions">      <a class="btn btn-sm" href="#">Read the guide</a>      <button type="button" class="btn btn-sm btn-primary">        <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 8L13 8" /><path d="M8 3L8 13" />        </svg>New project      </button>    </div>  </div></section>
import FolderIcon from '@master/icons-react/native/20/soft/folder'import PlusIcon from '@master/icons-react/native/16/soft/plus'<section className="sheet container-inline" aria-labelledby="es-title">  <div className="empty">    <div className="icon-frame empty-media" aria-hidden="true"><FolderIcon className="icon" /></div>    <h2 className="empty-title" id="es-title">No projects yet</h2>    <p className="empty-description">      A project connects a repository to an address. Create one, and every push becomes a deployment.    </p>    <div className="empty-actions">      <a className="btn btn-sm" href="#">Read the guide</a>      <button type="button" className="btn btn-sm btn-primary">        <PlusIcon className="icon" />New project      </button>    </div>  </div></section>
<script>  import FolderIcon from '@master/icons-svelte/native/20/soft/folder'  import PlusIcon from '@master/icons-svelte/native/16/soft/plus'</script><section class="sheet container-inline" aria-labelledby="es-title">  <div class="empty">    <div class="icon-frame empty-media" aria-hidden="true"><FolderIcon class="icon" /></div>    <h2 class="empty-title" id="es-title">No projects yet</h2>    <p class="empty-description">      A project connects a repository to an address. Create one, and every push becomes a deployment.    </p>    <div class="empty-actions">      <a class="btn btn-sm" href="#">Read the guide</a>      <button type="button" class="btn btn-sm btn-primary">        <PlusIcon class="icon" />New project      </button>    </div>  </div></section>
<script setup>import FolderIcon from '@master/icons-vue/native/20/soft/folder'import PlusIcon from '@master/icons-vue/native/16/soft/plus'</script><template>  <section class="sheet container-inline" aria-labelledby="es-title">    <div class="empty">      <div class="icon-frame empty-media" aria-hidden="true"><FolderIcon class="icon" /></div>      <h2 class="empty-title" id="es-title">No projects yet</h2>      <p class="empty-description">        A project connects a repository to an address. Create one, and every push becomes a deployment.      </p>      <div class="empty-actions">        <a class="btn btn-sm" href="#">Read the guide</a>        <button type="button" class="btn btn-sm btn-primary">          <PlusIcon class="icon" />New project        </button>      </div>    </div>  </section></template>

ブロックはコピーして使えるマークアップです。文字色と文字サイズは配置先のページに従います。プレビューでは body に fg-text-body text-sm を指定しています。各ブロックはサイズコンテナーで、幅の広いページ、サイドバーほどのスペース、ダイアログなど、配置先で確保できる自身の幅に応じてレイアウトが変わります。

#空になる 4 つの理由

ビューが空になる理由は 4 つあり、それぞれに合った文言が必要です。

種類伝えること案内する操作
まだ何もないここに表示される項目とその用途最初の項目を作成する操作
初回利用最初の成果を得るまでの数ステップ次のステップ
結果なし検索内容と、現在適用中のフィルター検索条件を広げる方法
エラーが発生した何が起きたか、問題が利用者側とサービス側のどちらにあるかを平易な言葉でアラート内で案内する再試行の操作

最初の例は上にあります。残りの 3 つは以下のとおりです。

#初回利用

利用者が初めてプロダクトを開いたときは、空のビューの代わりに使い始める手順を示します。ステップを縦に並べ、各ステップを 1 文で説明し、次に進む操作をプライマリボタンにします。済んだステップは完了状態で表示し、aria-current="step" で現在のステップを示します。

初回利用

<section class="sheet container-inline flex flex-col gap-lg p-xl max-w(560) mx-auto" aria-labelledby="es-steps-title">  <header class="flex flex-col gap-xs">    <h2 class="heading heading-lg" id="es-steps-title">Deploy your first project</h2>    <p class="m(0) leading-md">Three steps, about two minutes. You can stop after any of them.</p>  </header>  <ol class="steps steps-vertical">    <li class="steps-item">      <div class="steps-body">        <span class="steps-title">Connect a repository</span>        <span class="steps-description">Signed in with GitHub as yiching.</span>      </div>    </li>    <li class="steps-item" aria-current="step">      <div class="steps-body">        <span class="steps-title">Choose what to build</span>        <span class="steps-description">          Pick a repository and a branch. We detect the framework.        </span>      </div>    </li>    <li class="steps-item">      <div class="steps-body">        <span class="steps-title">Go live</span>        <span class="steps-description">Your site gets an address in under a minute.</span>      </div>    </li>  </ol>  <div class="flex flex-wrap gap-xs">    <button type="button" class="btn btn-primary">Choose a repository</button>    <button type="button" class="btn btn-quiet">Deploy an example instead</button>  </div></section>
<section className="sheet container-inline flex flex-col gap-lg p-xl max-w(560) mx-auto" aria-labelledby="es-steps-title">  <header className="flex flex-col gap-xs">    <h2 className="heading heading-lg" id="es-steps-title">Deploy your first project</h2>    <p className="m(0) leading-md">      Three steps, about two minutes. You can stop after any of them.    </p>  </header>  <ol className="steps steps-vertical">    <li className="steps-item">      <div className="steps-body">        <span className="steps-title">Connect a repository</span>        <span className="steps-description">Signed in with GitHub as yiching.</span>      </div>    </li>    <li className="steps-item" aria-current="step">      <div className="steps-body">        <span className="steps-title">Choose what to build</span>        <span className="steps-description">          Pick a repository and a branch. We detect the framework.        </span>      </div>    </li>    <li className="steps-item">      <div className="steps-body">        <span className="steps-title">Go live</span>        <span className="steps-description">Your site gets an address in under a minute.</span>      </div>    </li>  </ol>  <div className="flex flex-wrap gap-xs">    <button type="button" className="btn btn-primary">Choose a repository</button>    <button type="button" className="btn btn-quiet">Deploy an example instead</button>  </div></section>
<section class="sheet container-inline flex flex-col gap-lg p-xl max-w(560) mx-auto" aria-labelledby="es-steps-title">  <header class="flex flex-col gap-xs">    <h2 class="heading heading-lg" id="es-steps-title">Deploy your first project</h2>    <p class="m(0) leading-md">Three steps, about two minutes. You can stop after any of them.</p>  </header>  <ol class="steps steps-vertical">    <li class="steps-item">      <div class="steps-body">        <span class="steps-title">Connect a repository</span>        <span class="steps-description">Signed in with GitHub as yiching.</span>      </div>    </li>    <li class="steps-item" aria-current="step">      <div class="steps-body">        <span class="steps-title">Choose what to build</span>        <span class="steps-description">          Pick a repository and a branch. We detect the framework.        </span>      </div>    </li>    <li class="steps-item">      <div class="steps-body">        <span class="steps-title">Go live</span>        <span class="steps-description">Your site gets an address in under a minute.</span>      </div>    </li>  </ol>  <div class="flex flex-wrap gap-xs">    <button type="button" class="btn btn-primary">Choose a repository</button>    <button type="button" class="btn btn-quiet">Deploy an example instead</button>  </div></section>
<template>  <section class="sheet container-inline flex flex-col gap-lg p-xl max-w(560) mx-auto" aria-labelledby="es-steps-title">    <header class="flex flex-col gap-xs">      <h2 class="heading heading-lg" id="es-steps-title">Deploy your first project</h2>      <p class="m(0) leading-md">Three steps, about two minutes. You can stop after any of them.</p>    </header>    <ol class="steps steps-vertical">      <li class="steps-item">        <div class="steps-body">          <span class="steps-title">Connect a repository</span>          <span class="steps-description">Signed in with GitHub as yiching.</span>        </div>      </li>      <li class="steps-item" aria-current="step">        <div class="steps-body">          <span class="steps-title">Choose what to build</span>          <span class="steps-description">            Pick a repository and a branch. We detect the framework.          </span>        </div>      </li>      <li class="steps-item">        <div class="steps-body">          <span class="steps-title">Go live</span>          <span class="steps-description">Your site gets an address in under a minute.</span>        </div>      </li>    </ol>    <div class="flex flex-wrap gap-xs">      <button type="button" class="btn btn-primary">Choose a repository</button>      <button type="button" class="btn btn-quiet">Deploy an example instead</button>    </div>  </section></template>

#結果なし

検索や絞り込みの結果が 0 件なら、入力された検索語を誤字も含めてそのまま表示し、現在適用されているフィルターを示します。リストが空になった理由が分からないと、利用者はデータが消えたと思ってしまいます。

結果なし

<section class="sheet container-inline" aria-live="polite" aria-labelledby="es-none-title">  <div class="empty">    <div class="icon-frame empty-media" aria-hidden="true">      <svg class="icon" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">        <circle cx="8.75" cy="8.75" r="5.75" /><path d="M12.8159 12.8159L17.5 17.5" />      </svg>    </div>    <h2 class="empty-title" id="es-none-title">No projects match “drfit”</h2>    <p class="empty-description">      Check the spelling, or search all workspaces. Filters are still applied: Ready, Tokyo.    </p>    <div class="empty-actions">      <button type="button" class="btn btn-sm">Clear filters</button>      <button type="button" class="btn btn-sm">Search all workspaces</button>    </div>  </div></section>
import SearchIcon from '@master/icons-react/native/20/soft/search'<section className="sheet container-inline" aria-live="polite" aria-labelledby="es-none-title">  <div className="empty">    <div className="icon-frame empty-media" aria-hidden="true"><SearchIcon className="icon" /></div>    <h2 className="empty-title" id="es-none-title">No projects match “drfit”</h2>    <p className="empty-description">      Check the spelling, or search all workspaces. Filters are still applied: Ready, Tokyo.    </p>    <div className="empty-actions">      <button type="button" className="btn btn-sm">Clear filters</button>      <button type="button" className="btn btn-sm">Search all workspaces</button>    </div>  </div></section>
<script>  import SearchIcon from '@master/icons-svelte/native/20/soft/search'</script><section class="sheet container-inline" aria-live="polite" aria-labelledby="es-none-title">  <div class="empty">    <div class="icon-frame empty-media" aria-hidden="true"><SearchIcon class="icon" /></div>    <h2 class="empty-title" id="es-none-title">No projects match “drfit”</h2>    <p class="empty-description">      Check the spelling, or search all workspaces. Filters are still applied: Ready, Tokyo.    </p>    <div class="empty-actions">      <button type="button" class="btn btn-sm">Clear filters</button>      <button type="button" class="btn btn-sm">Search all workspaces</button>    </div>  </div></section>
<script setup>import SearchIcon from '@master/icons-vue/native/20/soft/search'</script><template>  <section class="sheet container-inline" aria-live="polite" aria-labelledby="es-none-title">    <div class="empty">      <div class="icon-frame empty-media" aria-hidden="true"><SearchIcon class="icon" /></div>      <h2 class="empty-title" id="es-none-title">No projects match “drfit”</h2>      <p class="empty-description">        Check the spelling, or search all workspaces. Filters are still applied: Ready, Tokyo.      </p>      <div class="empty-actions">        <button type="button" class="btn btn-sm">Clear filters</button>        <button type="button" class="btn btn-sm">Search all workspaces</button>      </div>    </div>  </section></template>

この領域には aria-live="polite" を設定しているため、検索結果が 0 件に変わったことは、利用者が入力を止めた後に読み上げられます。

#エラーが発生した

エラーは空の状態とは区別し、同じ位置にアラートとして表示します。状態を表す色とアイコンで異常を示し、文言で何が起きたかを伝え、ボタンを 1 つ置いて次の操作を案内します。利用者の作業内容が保持されている場合は、そのことを伝えます。セクションには表示に失敗したビューの名前を残すため、支援技術から引き続き同じランドマークを見つけられます。

エラーが発生した

<section class="container-inline" aria-label="Projects">  <div class="alert alert-danger" role="alert">    <svg class="icon alert-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <circle cx="8" cy="8" r="6" /><circle cx="8" cy="5" r="0.5" fill="currentColor" stroke="none" /><path d="M8 8L8 11" />    </svg>    <div class="alert-body">      <p class="alert-title">We could not load your projects</p>      <p class="alert-description">        The request timed out. Your projects are safe; this is on our side. <a class="link" href="#">Check the status page</a>.      </p>    </div>    <button type="button" class="btn btn-sm">Try again</button>  </div></section>
import InfoCircleIcon from '@master/icons-react/native/16/soft/info-circle'<section className="container-inline" aria-label="Projects">  <div className="alert alert-danger" role="alert">    <InfoCircleIcon className="icon alert-icon" />    <div className="alert-body">      <p className="alert-title">We could not load your projects</p>      <p className="alert-description">        The request timed out. Your projects are safe; this is on our side. <a className="link" href="#">Check the status page</a>.      </p>    </div>    <button type="button" className="btn btn-sm">Try again</button>  </div></section>
<script>  import InfoCircleIcon from '@master/icons-svelte/native/16/soft/info-circle'</script><section class="container-inline" aria-label="Projects">  <div class="alert alert-danger" role="alert">    <InfoCircleIcon class="icon alert-icon" />    <div class="alert-body">      <p class="alert-title">We could not load your projects</p>      <p class="alert-description">        The request timed out. Your projects are safe; this is on our side. <a class="link" href="#">Check the status page</a>.      </p>    </div>    <button type="button" class="btn btn-sm">Try again</button>  </div></section>
<script setup>import InfoCircleIcon from '@master/icons-vue/native/16/soft/info-circle'</script><template>  <section class="container-inline" aria-label="Projects">    <div class="alert alert-danger" role="alert">      <InfoCircleIcon class="icon alert-icon" />      <div class="alert-body">        <p class="alert-title">We could not load your projects</p>        <p class="alert-description">          The request timed out. Your projects are safe; this is on our side. <a class="link" href="#">Check the status page</a>.        </p>      </div>      <button type="button" class="btn btn-sm">Try again</button>    </div>  </section></template>

#アクセシビリティ

  • タイトルには、置き換えるビューと同じ階層の見出しを使います。
  • 操作に応じて現れる空の状態は、支援技術に通知します。結果がない場合は aria-live="polite"、エラーの場合は role="alert" を使います。
  • アイコンは装飾です。どの状態かを伝えるためにアイコンやその色に頼らず、文言で明示します。
  • 「ガイドを読む」は別の場所へ移動するため、ボタンの見た目にしたリンクを使います。「新規プロジェクト」は操作を実行するため、ボタンを使います。
  • 主アクションは、項目があるときのビューと揃えます。利用者は一度覚えた操作をそのまま使えます。