回饋
文字游標
出現在尚未寫完的文字末端的標記。
本頁內容
文字游標是出現在尚未寫完的文字末端的一道細直線,沿用前方文字的顏色,約每秒淡出再淡入一次。它可以放在串流輸出的回答末端,或放在表示等待中的提示文字後方,表示「後面還有內容」。
文字游標
<div class="message w-full max-w(420)" aria-busy="true"> <div class="message-bubble"> The table has two million rows, so the column is added as nullable first and filled in batches of ten thousand<span class="caret" aria-hidden="true"></span> </div></div><div className="message w-full max-w(420)" aria-busy="true"> <div className="message-bubble"> The table has two million rows, so the column is added as nullable first and filled in batches of ten thousand<span className="caret" aria-hidden="true"></span> </div></div><div class="message w-full max-w(420)" aria-busy="true"> <div class="message-bubble"> The table has two million rows, so the column is added as nullable first and filled in batches of ten thousand<span class="caret" aria-hidden="true"></span> </div></div><template> <div class="message w-full max-w(420)" aria-busy="true"> <div class="message-bubble"> The table has two million rows, so the column is added as nullable first and filled in batches of ten thousand<span class="caret" aria-hidden="true"></span> </div> </div></template>#放置位置
把文字游標放在容納文字的元素內,緊接在最後一個字後面,中間不要插入任何內容。它是行內盒,高度與所在行的文字相當,並沿用文字顏色,因此不必指定尺寸或變體。在頁面、卡片或使用墨色背景的區域中,都能接在標題、段落或一行程式碼後面。
文字寫完後請移除游標。若游標在最後一個字後面持續閃爍,讀者會以為還要再等。
搭配各種文字
<h3 class="heading heading-lg"> Writing the migration<span class="caret" aria-hidden="true"></span></h3><p class="m(0) text-sm fg-text-body"> Checking the three services that read the column<span class="caret" aria-hidden="true"></span></p><pre class="code-block w-full"><code>$ bun run build<span class="caret caret-block" aria-hidden="true"></span></code></pre><> <h3 className="heading heading-lg"> Writing the migration<span className="caret" aria-hidden="true"></span> </h3> <p className="m(0) text-sm fg-text-body"> Checking the three services that read the column<span className="caret" aria-hidden="true"></span> </p> <pre className="code-block w-full"><code>$ bun run build<span className="caret caret-block" aria-hidden="true"></span></code></pre></><h3 class="heading heading-lg"> Writing the migration<span class="caret" aria-hidden="true"></span></h3><p class="m(0) text-sm fg-text-body"> Checking the three services that read the column<span class="caret" aria-hidden="true"></span></p><pre class="code-block w-full"><code>$ bun run build<span class="caret caret-block" aria-hidden="true"></span></code></pre><template> <h3 class="heading heading-lg"> Writing the migration<span class="caret" aria-hidden="true"></span> </h3> <p class="m(0) text-sm fg-text-body"> Checking the three services that read the column<span class="caret" aria-hidden="true"></span> </p> <pre class="code-block w-full"><code>$ bun run build<span class="caret caret-block" aria-hidden="true"></span></code></pre></template>#方塊游標
caret-block 是終端機樣式的寬游標,寬度為半個 em。顯示 shell 的程式碼區塊或視窗中,可將它放在指令後方,以免細直線被誤認為字元。
#文字游標、微光或輸入提示
文字游標接在仍持續增加的文字後方。若內容還沒出現,畫面上只有簡短的處理中提示,請使用微光效果。若對話中的另一位使用者正在輸入,請在訊息上使用 message-typing。若是控制項正在等待處理完成,請使用載入轉圈。
#無障礙
- 文字游標是裝飾,請加上
aria-hidden="true"。 - 在文字持續寫入的區域加上
aria-busy="true",寫完後移除,讓螢幕閱讀器一次讀出完整文字,避免逐字播報。 - 使用
prefers-reduced-motion: reduce時,文字游標會靜止在文字末端。
#類別
| 類別 | 說明 |
|---|---|
caret | 接在文字後方的細直條,與前方文字同色、等高,約每秒淡出再淡入一次 |
caret-block | 終端機的文字游標,寬 0.5em搭配 caret 使用 |