回饋
空狀態
檢視畫面尚無內容可顯示時呈現的狀態。
本頁內容
空狀態會在檢視畫面尚無內容可顯示時出現,說明這裡會顯示什麼,並提供可讓內容出現的操作。元件採置中的單欄版面配置,最上方是一個圖示框,元件本身沒有獨立的背景樣式。可將它放在卡片、凹槽內,或直接放在頁面上。
空狀態
<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,就能讓它在單欄中就定位,下方留的空間比文字之間略多。圖示框只是裝飾,缺少的內容由標題說明。
#撰寫空狀態文案
- 用清楚直白的標題點出目前狀態,例如「尚無部署紀錄」。避免使用「這裡沒有任何內容」這類籠統的標題。
- 用一兩句話說明如何讓內容出現在這裡。說明文字在 24rem 寬度內換行。
- 提供一個主要操作。也可加入一個較低調的次要操作,連到相關文件。
#類別
| 類別 | 說明 |
|---|---|
empty | 置中的欄 |
empty-media | 加在頂端的 icon-frame 上:標示缺少的內容類型,並在下方保留空間 |
empty-title | 以淺白的文字描述狀態,例如「尚無部署」 |
empty-description | 用一兩句話說明如何讓畫面顯示內容。文字在 24rem 寬度換行。 |
empty-actions | 置中的一列按鈕 |