피드백
캐럿
작성 중인 텍스트 끝에 나타나는 표시입니다.
이 페이지의 내용
캐럿은 작성 중인 텍스트 끝에 표시하는 가느다란 세로 막대입니다. 앞의 글자와 같은 색으로 표시되며, 약 1초에 한 번씩 서서히 사라졌다가 다시 나타납니다. 답변이 스트리밍되는 동안이나 입력을 기다리는 프롬프트 뒤에서 텍스트가 더 이어질 자리임을 알려 줍니다.
캐럿
<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은 너비가 0.5em인 터미널용 캐럿입니다. 셸을 보여 주는 코드 블록이나 창에서는 가느다란 막대가 글자로 보일 수 있으므로 명령어 뒤에 블록 캐럿을 사용합니다.
#캐럿, 시머, 입력 중 표시
캐럿은 이미 표시된 텍스트에 내용이 계속 추가될 때 사용합니다. 아직 텍스트가 없고 짧은 문구로 작업이 진행 중임을 알릴 때는 시머를 사용합니다. 대화 상대가 입력 중일 때는 메시지에 message-typing을 사용합니다. 컨트롤의 대기 상태를 표시할 때는 스피너를 사용합니다.
#접근성
- 캐럿은 장식 요소이므로
aria-hidden="true"를 지정합니다. - 작성 중인 영역에
aria-busy="true"를 지정하고 작성이 끝나면 제거합니다. 이렇게 하면 스크린 리더가 단어가 추가될 때마다 읽는 대신 완성된 텍스트를 한 번만 읽을 수 있습니다. prefers-reduced-motion: reduce가 적용되면 캐럿은 깜박이지 않고 텍스트 끝에 그대로 표시됩니다.
#클래스
| 클래스 | 설명 |
|---|---|
caret | 바로 앞 텍스트와 색상과 글자 높이가 같은 가는 세로 막대입니다. 약 1초에 한 번씩 서서히 사라졌다가 다시 나타납니다. |
caret-block | 너비가 0.5em인 터미널 캐럿적용할 클래스는 caret입니다 |