배지

Badge

아이콘이나 버튼 모서리에 붙어 개수나 상태를 알려주는 작은 점 또는 숫자.

다른 이름: CounterNotification dotStatus badge
···
html
<div class="bgw">
  <div class="bgi"><span class="ico">🔔</span><span class="badge" id="bd">1</span></div>
  <div class="bgi"><span class="avatar-dot">👤<i class="status" id="stdot"></i></span></div>
</div>
css
.bgw{display:flex;gap:40px;align-items:center}
.bgi{position:relative}
.ico{width:44px;height:44px;border-radius:12px;background:var(--surface);border:1px solid var(--line);display:grid;place-items:center;font-size:19px}
.badge{position:absolute;top:-6px;right:-6px;min-width:18px;height:18px;padding:0 4px;border-radius:999px;background:#e5484d;color:#fff;
  font-size:10px;font-weight:700;display:grid;place-items:center;border:2px solid var(--bg)}
.avatar-dot{position:relative;width:44px;height:44px;border-radius:50%;background:var(--surface);border:1px solid var(--line);display:grid;place-items:center;font-size:19px}
.status{position:absolute;bottom:0;right:0;width:11px;height:11px;border-radius:50%;background:#2dd4bf;border:2px solid var(--bg);animation:pulse 1.6s ease-in-out infinite}
@keyframes pulse{50%{transform:scale(1.25)}}
js
const bd = document.getElementById('bd');
let n = 1;
setInterval(() => { n = n >= 9 ? 1 : n + 1; bd.textContent = n > 9 ? '9+' : String(n); }, 1000);

그 자체로는 클릭도 삭제도 되지 않는, 다른 요소에 "붙어 있는" 부가 정보입니다. 숫자 배지는 스크린리더용으로 "읽지 않은 메시지 3개" 같은 텍스트를 함께 제공해야 하고(숫자 "3"만으로는 무슨 의미인지 알 수 없습니다), 장식용으로만 쓰는 점(dot)은 aria-hidden="true"로 숨깁니다.

칩과 자주 혼동되지만 독립성이 다릅니다. 배지는 항상 다른 요소(아이콘, 아바타, 탭 라벨)에 얹혀서만 존재하고 스스로 클릭되지 않지만, 칩은 그 자체로 클릭하거나 지울 수 있는 독립된 요소입니다.

숫자가 두 자릿수를 넘어가면 "99+"처럼 자르는 게 일반적입니다 — 배지 자리는 좁아서 세 자릿수가 들어가면 아이콘을 가려버립니다.