網站導覽

v2.1.0
內文

徽章

顯示狀態、類別或數量的小型膠囊標籤;只有在顏色具有意義時才使用色彩。

本頁內容

徽章是顯示狀態、類別或數量的小型膠囊標籤。大多數標籤使用中性色。只有在表示狀態(並搭配說明同一狀態的文字)或標示資料的類別時,才會使用色彩。

徽章

<span class="badge">Draft</span><span class="badge badge-success badge-dot">Published</span>
<>  <span className="badge">Draft</span>  <span className="badge badge-success badge-dot">Published</span></>
<span class="badge">Draft</span><span class="badge badge-success badge-dot">Published</span>
<template>  <span class="badge">Draft</span>  <span class="badge badge-success badge-dot">Published</span></template>

#變體

變體

<span class="badge">Chip</span><span class="badge badge-outline">Outline</span><span class="badge badge-raised">Raised</span><span class="badge badge-ink">Ink</span>
<>  <span className="badge">Chip</span>  <span className="badge badge-outline">Outline</span>  <span className="badge badge-raised">Raised</span>  <span className="badge badge-ink">Ink</span></>
<span class="badge">Chip</span><span class="badge badge-outline">Outline</span><span class="badge badge-raised">Raised</span><span class="badge badge-ink">Ink</span>
<template>  <span class="badge">Chip</span>  <span class="badge badge-outline">Outline</span>  <span class="badge badge-raised">Raised</span>  <span class="badge badge-ink">Ink</span></template>

#狀態

狀態

<span class="badge badge-info badge-dot">Queued</span><span class="badge badge-success badge-dot">Ready</span><span class="badge badge-warning badge-dot">Degraded</span><span class="badge badge-danger badge-dot">Failed</span>
<>  <span className="badge badge-info badge-dot">Queued</span>  <span className="badge badge-success badge-dot">Ready</span>  <span className="badge badge-warning badge-dot">Degraded</span>  <span className="badge badge-danger badge-dot">Failed</span></>
<span class="badge badge-info badge-dot">Queued</span><span class="badge badge-success badge-dot">Ready</span><span class="badge badge-warning badge-dot">Degraded</span><span class="badge badge-danger badge-dot">Failed</span>
<template>  <span class="badge badge-info badge-dot">Queued</span>  <span class="badge badge-success badge-dot">Ready</span>  <span class="badge badge-warning badge-dot">Degraded</span>  <span class="badge badge-danger badge-dot">Failed</span></template>

#分類色

badge-category 會套用徽章本身或其外層 category-<name> 類別所設定分類的底面、文字與線條,圓點則使用該分類的標記色。分類說明某樣東西屬於哪一類,狀態說明它目前如何。一個徽章只能是其中一種:badge-category 不能與四種狀態色調同時使用。

分類色

<span class="badge badge-category category-blue">Platform</span><span class="badge badge-category badge-dot category-pink">Marketing</span><span class="badge badge-category badge-pill category-amber">Finance</span><span class="badge badge-category badge-outline category-teal">Design</span>
<>  <span className="badge badge-category category-blue">Platform</span>  <span className="badge badge-category badge-dot category-pink">Marketing</span>  <span className="badge badge-category badge-pill category-amber">Finance</span>  <span className="badge badge-category badge-outline category-teal">Design</span></>
<span class="badge badge-category category-blue">Platform</span><span class="badge badge-category badge-dot category-pink">Marketing</span><span class="badge badge-category badge-pill category-amber">Finance</span><span class="badge badge-category badge-outline category-teal">Design</span>
<template>  <span class="badge badge-category category-blue">Platform</span>  <span class="badge badge-category badge-dot category-pink">Marketing</span>  <span class="badge badge-category badge-pill category-amber">Finance</span>  <span class="badge badge-category badge-outline category-teal">Design</span></template>

#即時狀態

badge-live 讓圓點發出向外擴散的環形波紋,表示錄製、部署或串流正在進行。每個畫面只用它強調一件事,滿頁都是持續發出波紋的圓點會讓使用者難以辨別重點。啟用減少動態效果時,只會顯示靜止的圓點。

即時狀態

<span class="badge badge-success badge-dot badge-live">Live</span><span class="badge badge-danger badge-dot badge-live">Recording</span><span class="badge badge-dot">Idle</span>
<>  <span className="badge badge-success badge-dot badge-live">Live</span>  <span className="badge badge-danger badge-dot badge-live">Recording</span>  <span className="badge badge-dot">Idle</span></>
<span class="badge badge-success badge-dot badge-live">Live</span><span class="badge badge-danger badge-dot badge-live">Recording</span><span class="badge badge-dot">Idle</span>
<template>  <span class="badge badge-success badge-dot badge-live">Live</span>  <span class="badge badge-danger badge-dot badge-live">Recording</span>  <span class="badge badge-dot">Idle</span></template>

#尺寸與形狀

尺寸與形狀

<span class="badge badge-sm">Small</span><span class="badge">Medium</span><span class="badge badge-lg">Large</span><span class="badge badge-pill">Pill</span><span class="badge badge-ink badge-pill">12</span>
<>  <span className="badge badge-sm">Small</span>  <span className="badge">Medium</span>  <span className="badge badge-lg">Large</span>  <span className="badge badge-pill">Pill</span>  <span className="badge badge-ink badge-pill">12</span></>
<span class="badge badge-sm">Small</span><span class="badge">Medium</span><span class="badge badge-lg">Large</span><span class="badge badge-pill">Pill</span><span class="badge badge-ink badge-pill">12</span>
<template>  <span class="badge badge-sm">Small</span>  <span class="badge">Medium</span>  <span class="badge badge-lg">Large</span>  <span class="badge badge-pill">Pill</span>  <span class="badge badge-ink badge-pill">12</span></template>

#圖片與長標籤

badge-media 在開頭放一張小圖片,例如頭像或圖示。它的大小等於徽章高度減去兩側內距,並維持圓形,因此與徽章端點之間保有均勻的空間。可能很長的標籤請包在 badge-label 中:徽章會在容器邊緣停止延伸,標籤以省略號結尾,圖片則維持原本大小。

圖片與長標籤

<span class="badge badge-pill">  <span class="badge-media"><span class="avatar" aria-hidden="true">AL</span></span>Ada</span><span class="badge badge-pill">  <span class="badge-media">    <span class="avatar"><img class="avatar-image" src="/demo/portrait-2.svg" alt></span>  </span>Grace Hopper</span><span class="badge max-w(168)" title="Interview notes from the second round">  <span class="badge-media">    <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">      <path d="M4.5 2L9.0858 2A1 1 0 0 1 9.7929 2.2929L12.2071 4.7071A1 1 0 0 1 12.5 5.4142L12.5 13A1 1 0 0 1 11.5 14L4.5 14A1 1 0 0 1 3.5 13L3.5 3A1 1 0 0 1 4.5 2Z" /><path d="M10 2.5V4.4A0.1 0.1 0 0 0 10.1 4.5H12L12.2409 4.7427A0.9993 0.9993 0 0 1 12.5 5.4142V5.5H10.1Q9.6444 5.5 9.3222 5.1778Q9 4.8556 9 4.4V2A1.1002 1.1002 0 0 1 9.3761 2.0431A1.0001 1.0001 0 0 1 9.7929 2.2929L10 2.5Z" fill="currentColor" stroke="none" fill-rule="evenodd" />    </svg>  </span><span class="badge-label">Interview notes from the second round</span></span>
import FileIcon from '@master/icons-react/native/16/soft/file'<>  <span className="badge badge-pill">    <span className="badge-media"><span className="avatar" aria-hidden="true">AL</span></span>Ada  </span>  <span className="badge badge-pill">    <span className="badge-media">      <span className="avatar">        <img className="avatar-image" src="/demo/portrait-2.svg" alt="" />      </span>    </span>Grace Hopper  </span>  <span className="badge max-w(168)" title="Interview notes from the second round">    <span className="badge-media"><FileIcon className="icon" /></span><span className="badge-label">Interview notes from the second round</span>  </span></>
<script>  import FileIcon from '@master/icons-svelte/native/16/soft/file'</script><span class="badge badge-pill">  <span class="badge-media"><span class="avatar" aria-hidden="true">AL</span></span>Ada</span><span class="badge badge-pill">  <span class="badge-media">    <span class="avatar"><img class="avatar-image" src="/demo/portrait-2.svg" alt></span>  </span>Grace Hopper</span><span class="badge max-w(168)" title="Interview notes from the second round">  <span class="badge-media"><FileIcon class="icon" /></span><span class="badge-label">Interview notes from the second round</span></span>
<script setup>import FileIcon from '@master/icons-vue/native/16/soft/file'</script><template>  <span class="badge badge-pill">    <span class="badge-media"><span class="avatar" aria-hidden="true">AL</span></span>Ada  </span>  <span class="badge badge-pill">    <span class="badge-media">      <span class="avatar"><img class="avatar-image" src="/demo/portrait-2.svg" alt></span>    </span>Grace Hopper  </span>  <span class="badge max-w(168)" title="Interview notes from the second round">    <span class="badge-media"><FileIcon class="icon" /></span><span class="badge-label">Interview notes from the second round</span>  </span></template>

#複合徽章

badge-compound 在同一個膠囊中放入一個較小的徽章 badge-addon 與一段簡短訊息,例如版本號與該版本的新功能,或標籤與日期。膠囊的高度多出兩倍內距,圓角等於附加徽章的圓角加上內距,讓兩條弧線平行。附加徽章可以放在開頭或結尾。作為連結時,整個膠囊是單一的點擊目標:懸停效果與焦點外框都套用在膠囊上,內部不包含任何獨立的控制項。

複合徽章

<a href="#theming" class="badge badge-compound badge-pill">  <span class="badge-addon">New</span><span class="badge-label">Theming has a guide</span><svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">    <path d="M13.6362 7.5189A0.4947 0.4947 0 0 0 13.5 7.5L2.4755 7.5006A0.5 0.5 0 0 0 2.4266 8.4946L2.5 8.5H13.5A0.4947 0.4947 0 0 0 13.6362 8.4811A0.7009 0.7009 0 0 0 13.6362 7.5189Z" fill="currentColor" stroke="none" fill-rule="evenodd" /><path d="M8 4.5L13.2348 7.8313A0.2 0.2 0 0 1 13.2348 8.1687L8 11.5" />  </svg></a><a href="#release" class="badge badge-compound badge-category category-violet">  <span class="badge-addon">v0.4</span><span class="badge-label">Category colors</span></a><span class="badge badge-compound">  <span class="badge-label">Release notes</span><span class="badge-addon">2 days ago</span></span>
import ArrowRightIcon from '@master/icons-react/native/16/soft/arrow-right'<>  <a href="#theming" className="badge badge-compound badge-pill">    <span className="badge-addon">New</span><span className="badge-label">Theming has a guide</span><ArrowRightIcon className="icon" />  </a>  <a href="#release" className="badge badge-compound badge-category category-violet">    <span className="badge-addon">v0.4</span><span className="badge-label">Category colors</span>  </a>  <span className="badge badge-compound">    <span className="badge-label">Release notes</span><span className="badge-addon">2 days ago</span>  </span></>
<script>  import ArrowRightIcon from '@master/icons-svelte/native/16/soft/arrow-right'</script><a href="#theming" class="badge badge-compound badge-pill">  <span class="badge-addon">New</span><span class="badge-label">Theming has a guide</span><ArrowRightIcon class="icon" /></a><a href="#release" class="badge badge-compound badge-category category-violet">  <span class="badge-addon">v0.4</span><span class="badge-label">Category colors</span></a><span class="badge badge-compound">  <span class="badge-label">Release notes</span><span class="badge-addon">2 days ago</span></span>
<script setup>import ArrowRightIcon from '@master/icons-vue/native/16/soft/arrow-right'</script><template>  <a href="#theming" class="badge badge-compound badge-pill">    <span class="badge-addon">New</span><span class="badge-label">Theming has a guide</span><ArrowRightIcon class="icon" />  </a>  <a href="#release" class="badge badge-compound badge-category category-violet">    <span class="badge-addon">v0.4</span><span class="badge-label">Category colors</span>  </a>  <span class="badge badge-compound">    <span class="badge-label">Release notes</span><span class="badge-addon">2 days ago</span>  </span></template>

#放在圖示上

badge-corner 將數量徽章放在最近的已定位祖先元素一角,並用與所在底面同色的環形描邊勾出輪廓。顏色取自 --surface-color。若使用自訂背景,請設定 --badge-ring。請在該定位祖先元素的無障礙名稱中說明徽章所顯示的數量。

放在圖示上

<button type="button" class="btn btn-square relative" aria-label="Notifications, 3 unread">  <svg class="icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">    <path d="M4.25 6C4.25 4.25 6 2.5 8 2.5C10 2.5 11.75 4.25 11.75 6V8.25C11.75 9.75 12.75 10.75 13.25 11.25Q13.5 11.75 12.75 11.75H3.25Q2.5 11.75 2.75 11.25C3.25 10.75 4.25 9.75 4.25 8.25Z" /><path d="M6.85 14Q8 15 9.15 14" />  </svg>  <span class="badge badge-ink badge-corner" aria-hidden="true">3</span></button>
import BellIcon from '@master/icons-react/native/16/soft/bell'<button type="button" className="btn btn-square relative" aria-label="Notifications, 3 unread">  <BellIcon className="icon" />  <span className="badge badge-ink badge-corner" aria-hidden="true">3</span></button>
<script>  import BellIcon from '@master/icons-svelte/native/16/soft/bell'</script><button type="button" class="btn btn-square relative" aria-label="Notifications, 3 unread">  <BellIcon class="icon" />  <span class="badge badge-ink badge-corner" aria-hidden="true">3</span></button>
<script setup>import BellIcon from '@master/icons-vue/native/16/soft/bell'</script><template>  <button type="button" class="btn btn-square relative" aria-label="Notifications, 3 unread">    <BellIcon class="icon" />    <span class="badge badge-ink badge-corner" aria-hidden="true">3</span>  </button></template>

#類別

類別說明
badge高 22px 的中性色標記。
badge-sm高度 18px,預設為 22px搭配 badge 使用
badge-lg高度 26px,預設為 22px搭配 badge 使用
badge-pill兩端呈半圓形搭配 badge 使用
badge-outline只有外框,沒有填色搭配 badge 使用
badge-raised略微浮起的小面板,讓徽章在繁複的背景上清楚可見搭配 badge 使用
badge-ink實色底搭配反色文字搭配 badge 使用
badge-category套用其本身或外層 category-<name> 類別所設定分類的底面、文字與線條;搭配 badge-dot 時,圓點使用分類的標記色。沒有分類時為中性。絕不與狀態色調並用搭配 badge 使用
badge-info資訊狀態的淡色背景搭配 badge 使用
badge-success成功狀態的淡色背景搭配 badge 使用
badge-warning警告狀態的淡色背景搭配 badge 使用
badge-danger危險狀態的淡色背景搭配 badge 使用
badge-dot徽章前方的 6px 圓點,使用徽章的狀態色搭配 badge 使用
badge-live搭配 badge-dot 時,圓點會向外擴散一圈,表示有活動正在進行。啟用減少動態效果時只顯示圓點搭配 badge 使用
badge-corner計數顯示在最近的已定位父元素角落,並以與背景同色的外環隔開。請在父元素的無障礙名稱中說明此計數。搭配 badge 使用
badge-compound高 28px 的膠囊,容納一個 badge-addon 和一段訊息;其圓角等於附加徽章的圓角加上內距。作為連結時,整個膠囊是單一點擊目標搭配 badge 使用
badge-label可能很長的文字:空間不足時會縮短並以省略號結尾,圖片、圓點或數量則維持原本大小
badge-media開頭的圓形圖片,大小為徽章高度減去兩倍內距:可容納頭像或圖示,並決定其大小
badge-addonbadge-compound 內較小的浮起徽章,位於開頭或結尾;其圓角等於外側圓角減去內距

#自訂屬性

屬性預設值說明
--badge-ringbadge-corner 的外圈顏色。未宣告此值時,會依序採用 --surface-color、--color-surface-base
--badge-inset.1875rembadge-media 或 badge-addon 與徽章邊緣之間的距離

#原始碼

@master/ui/components/badge.css
/* * Badge: a small chip for a status, a category or a count. Hue appears with a status, in one of four tones, or with * a category, read from --category-* (see category.css); the two are different facts and never share a badge. * A badge may hold a picture (badge-media), a label that truncates (badge-label) and, as a compound, a smaller * badge of its own (badge-addon) whose corner nests inside the outer one. * The neutral face, the outline and the ink badge read their colors through --badge-surface, --badge-ink, * --badge-line, --badge-line-strong, --badge-fill, --badge-fill-ink and --badge-fill-text, which a surface of * ink sets with @apply --on-ink, so a badge in a primary button or a tooltip is drawn from that surface's own * text color. */@layer components.ui {  .badge {    --badge-height: 1.375rem;    --badge-padding-x: .4375rem;    --badge-font-size: .71875rem;    --badge-radius: var(--radius-chip);    --badge-tone: var(--color-text-muted);    --badge-inset: .1875rem;    --icon-size: .875rem;    --icon-offset: -.0625rem;    display: inline-flex;    flex-shrink: 0;    align-items: center;    justify-content: center;    gap: .3125rem;    height: var(--badge-height);    min-width: var(--badge-height);    padding: 0 var(--badge-padding-x);    border-radius: calc(var(--badge-radius) * var(--corner-scale));    corner-shape: var(--corner-shape);    background: var(--badge-surface, var(--color-surface-chip));    color: var(--badge-ink, var(--color-text-body));    box-shadow: inset 0 0 0 .5px var(--badge-line, var(--color-line-contour));    font: var(--font-weight-control) var(--badge-font-size)/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    letter-spacing: 0;    white-space: nowrap;    /* A badge may be a link, such as the announcement over a hero; it never takes a link's underline. */    text-decoration: none;    vertical-align: middle;    &.badge-sm {      --badge-height: 1.125rem;      --badge-padding-x: .3125rem;      --badge-font-size: .65625rem;      --icon-size: .75rem;      --badge-radius: calc(var(--radius-chip) - 1px);      gap: .25rem;    }    &.badge-lg {      --badge-height: 1.625rem;      --badge-padding-x: .5625rem;      --badge-font-size: .78125rem;      --icon-size: 1rem;      --badge-radius: calc(var(--radius-chip) + 1px);    }    &.badge-pill {      --badge-radius: 999px;      corner-shape: round;      padding-inline: calc(var(--badge-padding-x) + 1px);    }    &.badge-outline {      background: transparent;      box-shadow: inset 0 0 0 .5px var(--badge-line-strong, var(--color-line-strong));    }    /* Raised: a small sheet, for a badge that sits on a busy surface. */    &.badge-raised {      @apply --surface-sheet;      color: var(--color-text-strong);      box-shadow: var(--shadow-raised);    }    &.badge-ink {      --badge-tone: currentColor;      background: var(--badge-fill, var(--color-surface-inverse));      color: var(--badge-fill-ink, var(--color-text-inverse));      -webkit-text-fill-color: var(--badge-fill-text, currentColor);      box-shadow: inset 0 .5px 0 var(--color-ink-highlight), 0 0 0 .5px var(--color-ink-edge);    }    &:is(.badge-info, .badge-success, .badge-warning, .badge-danger) {      background: color-mix(in oklab, var(--badge-tone) 8%, var(--color-surface-raised));      color: color-mix(in oklab, var(--badge-tone) 82%, var(--color-text-strong));      box-shadow: inset 0 0 0 .5px color-mix(in oklab, var(--badge-tone) 36%, transparent);    }    /* A category: its tinted surface, its text and its line, with the mark as the dot. Neutral without one. */    &.badge-category {      --badge-tone: var(--category-mark, var(--color-text-muted));      background: var(--category-surface, var(--color-surface-chip));      color: var(--category-text, var(--color-text-body));      box-shadow: inset 0 0 0 .5px var(--category-line, var(--color-line-contour));      &.badge-outline {        background: transparent;      }    }    &.badge-info { --badge-tone: var(--color-info); }    &.badge-success { --badge-tone: var(--color-success); }    &.badge-warning { --badge-tone: var(--color-warning); }    &.badge-danger { --badge-tone: var(--color-danger); }    /* A leading status dot in the badge's tone. */    &.badge-dot::before {      content: '';      flex: none;      width: 6px;      height: 6px;      border-radius: 999px;      corner-shape: round;      background: var(--badge-tone);    }    /* Live: the dot of something happening now sends out a ring. Without motion it is a plain dot. */    &.badge-live::before {      animation: badge-live 1.8s var(--easing-glide) infinite;    }    @media (prefers-reduced-motion: reduce) {      &.badge-live::before {        animation: none;      }    }    /* A label that may be long: the badge stops at its container's edge and the label ends in an ellipsis. */    &:has(.badge-label) {      /* It gives way beside a sibling too: a badge that never shrinks ran past the row by the sibling's width. */      flex-shrink: 1;      min-width: 0;      max-width: 100%;    }    /* A picture at the start stands as far from the badge's edge as from its top and bottom. */    &:has(.badge-media:first-child) {      padding-inline-start: var(--badge-inset);    }    /*     * Compound: a smaller badge (badge-addon) and a message inside one capsule, such as "New · Theming has a     * guide". The outer badge is taller by two insets, and its corner is the addon's corner plus the inset, so the     * two curves run parallel. A link around it is one target: the capsule takes the hover and the focus ring.     * The message is an element (a badge-label) beside the addon: a selector cannot see bare text, so an addon that     * is the only element would count as both ends and pull the message against the edge. Alone, it takes neither.     */    &.badge-compound {      --badge-height: 1.75rem;      --badge-padding-x: .625rem;      --badge-font-size: .78125rem;      --badge-radius: calc(var(--radius-chip) + var(--badge-inset));      gap: .5rem;      &:has(.badge-addon:first-child:not(:only-child)) {        padding-inline-start: var(--badge-inset);      }      &:has(.badge-addon:last-child:not(:only-child)) {        padding-inline-end: var(--badge-inset);      }      &.badge-pill .badge-addon {        --badge-radius: 999px;        corner-shape: round;      }    }    &:any-link {      -webkit-tap-highlight-color: transparent;      transition-property: box-shadow, color;      transition-duration: var(--duration-quick);      transition-timing-function: var(--easing-glide);      @media (hover: hover) {        /* The contour firms toward the badge's own text, whatever its face. */        &:hover {          box-shadow: inset 0 0 0 .5px color-mix(in oklab, currentColor 45%, transparent);        }      }      /* Pressed: the same firm contour, so a tap is answered where there is no pointer. */      &:active {        box-shadow: inset 0 0 0 .5px color-mix(in oklab, currentColor 45%, transparent);      }      /* A raised badge keeps its sheet: it lifts its shadow, as a raised control does, instead of losing it. */      &.badge-raised {        @media (hover: hover) {          &:hover {            box-shadow: var(--shadow-raised-hover);          }        }        &:active {          box-shadow: var(--shadow-raised-hover);        }      }      &:focus-visible {        @apply --focus-ring;      }      /* On touch a link's target reaches 44px around it; the capsule keeps its height and its corner. */      @media (pointer: coarse) {        &:not(.badge-corner) {          position: relative;        }        &::after {          @apply --touch-target;        }      }    }    /* A count on the corner of its nearest positioned parent, cut out by a ring of the surface it sits on. */    &.badge-corner {      --badge-height: 1.125rem;      corner-shape: round;      --badge-padding-x: .3125rem;      --badge-font-size: .65625rem;      --badge-radius: 999px;      position: absolute;      inset-block-start: 0;      inset-inline-end: 0;      translate: 35% -35%;      outline: 2px solid var(--badge-ring, var(--surface-color, var(--color-surface-base)));      /* It hangs off the end corner, whichever side that is. */      &:dir(rtl) {        translate: -35% -35%;      }    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;      /* The dot's tone would be forced to the canvas and vanish: it takes the text's system color. */      &.badge-dot::before {        background: CanvasText;      }      /* The words keep the system's text color, whatever face an ink surface would paint them in. */      &.badge-ink {        -webkit-text-fill-color: currentColor;      }    }  }}@layer components.ui {  /* The words of a badge that may be long: they shrink and end in an ellipsis, while a picture or a count keeps its size. */  .badge-label {    min-width: 0;    overflow: hidden;    /* A line as tall as the letters would clip their descenders; the badge centers the taller line, so nothing moves. */    line-height: 1.25;    text-overflow: ellipsis;  }  /*   * A picture at the start of a badge: an avatar, a flag or a logo, sized to the badge less two insets and kept   * round, so it sits in the badge's end as a pearl sits in a setting. Put an avatar or an icon inside; this part   * sizes them through --avatar-size and --icon-size.   */  .badge-media {    --badge-media-size: calc(var(--badge-height) - 2 * var(--badge-inset));    --icon-size: calc(var(--badge-media-size) - .125rem);    display: inline-grid;    flex: none;    place-items: center;    width: var(--badge-media-size);    height: var(--badge-media-size);    margin-inline-end: -.0625rem;    border-radius: 999px;    corner-shape: round;    overflow: hidden;    .avatar {      --avatar-size: var(--badge-media-size);    }  }  /*   * The smaller badge inside a compound badge: a raised face on the outer one's tint, one inset in from its edges,   * so its corner is the outer corner less the inset. It takes the category or the tone of the outer badge.   */  .badge-addon {    display: inline-flex;    flex: none;    align-items: center;    gap: .25rem;    height: calc(var(--badge-height) - 2 * var(--badge-inset));    padding: 0 .4375rem;    border-radius: calc(var(--badge-radius) * var(--corner-scale) - var(--badge-inset));    corner-shape: var(--corner-shape);    @apply --surface-sheet;    color: inherit;    box-shadow: var(--shadow-raised);    font-size: .71875rem;    white-space: nowrap;    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;    }  }  /*   * In a neutral badge the addon's sheet keeps the page's ink. Off ink that is the badge's own; on ink the badge   * takes the surface's text color, which on a pearl sheet would vanish.   */  .badge:not(.badge-info, .badge-success, .badge-warning, .badge-danger, .badge-category, .badge-ink, .badge-raised) .badge-addon {    color: var(--color-text-body);  }}@keyframes badge-live {  from {    box-shadow: 0 0 0 0 color-mix(in oklab, var(--badge-tone) 45%, transparent);  }  70%, to {    box-shadow: 0 0 0 5px transparent;  }}