ナビゲーション

v2.1.0
フィードバック

空の状態

ビューに表示する内容がまだないときに示す状態です。

このページの内容

空の状態は、ビューに表示する内容がまだないときに使います。ここに何が表示されるかを伝え、内容を追加するための操作を案内します。アイコンフレームを先頭に置いた中央揃えの縦並びレイアウトで、独自の背景面は持ちません。カードやウェルの中、またはページ上に直接配置できます。

空の状態

<div class="well">  <div class="empty">    <div class="icon-frame icon-frame-raised 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="M9.4989 2.6265A0.625 0.625 0 0 0 9.375 3L9.3758 12.0307A0.625 0.625 0 0 0 10.6182 12.0917L10.625 12L10.623 2.95A0.6252 0.6252 0 0 0 10.5011 2.6265Q10.2855 2.4578 10 2.4578Q9.7145 2.4578 9.4989 2.6265Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M6.5 6.5L9.8586 3.1414A0.2 0.2 0 0 1 10.1414 3.1414L13.5 6.5" /><path d="M3 13.5L3 15.75A1.25 1.25 0 0 0 4.25 17L15.75 17A1.25 1.25 0 0 0 17 15.75L17 13.5" />      </svg>    </div>    <h3 class="empty-title">No deployments yet</h3>    <p class="empty-description">      Push to the main branch, or deploy from the dashboard, and the deployment appears here.    </p>    <div class="empty-actions">      <button type="button" class="btn btn-sm">Read the guide</button>      <button type="button" class="btn btn-sm btn-primary">Deploy now</button>    </div>  </div></div>
import UploadIcon from '@master/icons-react/native/20/soft/upload'<div className="well">  <div className="empty">    <div className="icon-frame icon-frame-raised empty-media" aria-hidden="true">      <UploadIcon className="icon" />    </div>    <h3 className="empty-title">No deployments yet</h3>    <p className="empty-description">      Push to the main branch, or deploy from the dashboard, and the deployment appears here.    </p>    <div className="empty-actions">      <button type="button" className="btn btn-sm">Read the guide</button>      <button type="button" className="btn btn-sm btn-primary">Deploy now</button>    </div>  </div></div>
<script>  import UploadIcon from '@master/icons-svelte/native/20/soft/upload'</script><div class="well">  <div class="empty">    <div class="icon-frame icon-frame-raised empty-media" aria-hidden="true">      <UploadIcon class="icon" />    </div>    <h3 class="empty-title">No deployments yet</h3>    <p class="empty-description">      Push to the main branch, or deploy from the dashboard, and the deployment appears here.    </p>    <div class="empty-actions">      <button type="button" class="btn btn-sm">Read the guide</button>      <button type="button" class="btn btn-sm btn-primary">Deploy now</button>    </div>  </div></div>
<script setup>import UploadIcon from '@master/icons-vue/native/20/soft/upload'</script><template>  <div class="well">    <div class="empty">      <div class="icon-frame icon-frame-raised empty-media" aria-hidden="true">        <UploadIcon class="icon" />      </div>      <h3 class="empty-title">No deployments yet</h3>      <p class="empty-description">        Push to the main branch, or deploy from the dashboard, and the deployment appears here.      </p>      <div class="empty-actions">        <button type="button" class="btn btn-sm">Read the guide</button>        <button type="button" class="btn btn-sm btn-primary">Deploy now</button>      </div>    </div>  </div></template>

絞り込みや検索で結果が得られなかった場合は、検索や絞り込みの条件を示し、元の表示に戻る方法を案内します。メディアと操作ボタンは省略できます。

検索結果がない場合

<div class="empty">  <h3 class="empty-title">No projects match "atlsa"</h3>  <p class="empty-description">Check the spelling, or clear the search to see all 12 projects.</p>  <div class="empty-actions"><button type="button" class="btn btn-sm">Clear search</button></div></div>
<div className="empty">  <h3 className="empty-title">No projects match "atlsa"</h3>  <p className="empty-description">    Check the spelling, or clear the search to see all 12 projects.  </p>  <div className="empty-actions">    <button type="button" className="btn btn-sm">Clear search</button>  </div></div>
<div class="empty">  <h3 class="empty-title">No projects match "atlsa"</h3>  <p class="empty-description">Check the spelling, or clear the search to see all 12 projects.</p>  <div class="empty-actions"><button type="button" class="btn btn-sm">Clear search</button></div></div>
<template>  <div class="empty">    <h3 class="empty-title">No projects match "atlsa"</h3>    <p class="empty-description">Check the spelling, or clear the search to see all 12 projects.</p>    <div class="empty-actions"><button type="button" class="btn btn-sm">Clear search</button></div>  </div></template>

#アイコン

アイコンはアイコンフレームの中に置きます。フレームがアイコンの素材感を決めます。通常はページに押し込まれたウェルで、上の例のように空の状態をウェルの中に置く場合は、浮き上がったシート icon-frame-raised を使います。フレームに empty-media を付けると縦並びの中での位置が決まり、その下には文言どうしの間隔より少し広い余白が空きます。フレームは装飾です。何がないのかはタイトルで伝えます。

#文言の書き方

  • タイトルには「ここには何もありません」のような曖昧な表現を避け、「デプロイはまだありません」のように状態を具体的に示します。
  • 説明文では、どうすればビューに内容が表示されるかを1〜2文で伝えます。テキストは幅24remで折り返されます。
  • 主な操作を1つ提示します。必要に応じて、ドキュメントへの案内を控えめな副次操作として添えられます。

#クラス

クラス説明
empty中央揃えの列
empty-media上部の icon-frame に付けます。何がないのかの種類を示し、下に余白を設けます
empty-title「デプロイはまだありません」など、状態を平易な言葉で示す文言
empty-descriptionビューに内容が表示されるようにする方法を 1〜2 文で説明します。24rem の幅で折り返します。
empty-actions中央揃えのボタン列

#ソース

@master/ui/components/empty.css
/* * Empty: what a view shows when it has nothing to show yet: what belongs here, and the action that fills it. * A centered column, headed by an icon frame. It has no surface of its own; put it in a card, a sheet or a * well, or let it stand on the page. The frame's material is the icon frame's; empty-media only gives it its * place in the column. */@layer components.ui {  .empty {    display: flex;    flex-direction: column;    align-items: center;    gap: .375rem;    min-width: 0;    padding: 2.5rem 1.5rem;    color: var(--color-text-muted);    font-size: .875rem;    line-height: 1.55;    text-align: center;  }  /* The icon frame that names the kind of thing that is missing: a little more room under it than between the words. */  .empty-media {    margin-block-end: .625rem;  }  .empty-title {    margin: 0;    color: var(--color-text-strong);    font: var(--font-weight-control) .9375rem/1.4 var(--font-family-sans);    font-feature-settings: inherit;    text-wrap: balance;    overflow-wrap: anywhere;  }  .empty-description {    max-width: 24rem;    margin: 0;    text-wrap: pretty;    overflow-wrap: anywhere;  }  /* The actions stand 24px under the words: the column's 6px gap and 18px more. */  .empty-actions {    display: flex;    flex-wrap: wrap;    justify-content: center;    gap: .5rem;    margin-block-start: 1.125rem;  }}