網站導覽

v2.1.0
回饋

進度

隨工作完成逐步填色的細軌道。

本頁內容

進度元件顯示工作已完成多少。將 .progress 套用到原生 <progress>,瀏覽器就會將數值提供給輔助技術,類別則會繪製一條隨進度填色的細軌道。若要在控制項內表示耗時未定的工作,請使用旋轉指示器。

進度

<label class="field">  Uploading 3 of 5 files <progress class="progress" value="62" max="100">62%</progress></label>
<label className="field">  Uploading 3 of 5 files <progress className="progress" value="62" max="100">62%</progress></label>
<label class="field">  Uploading 3 of 5 files <progress class="progress" value="62" max="100">62%</progress></label>
<template>  <label class="field">    Uploading 3 of 5 files <progress class="progress" value="62" max="100">62%</progress>  </label></template>

#不確定進度

進度未知時,省略 value。色帶會沿著軌道移動。使用者若啟用減少動態效果,軌道則會以均勻的中間色調靜止顯示。

不確定進度

<label class="field">Preparing the build <progress class="progress"></progress></label>
<label className="field">Preparing the build <progress className="progress"></progress></label>
<label class="field">Preparing the build <progress class="progress"></progress></label>
<template>  <label class="field">Preparing the build <progress class="progress"></progress></label></template>

#尺寸

軌道預設厚度為 6px。progress-sm 為 4px,適合清單項目。progress-lg 為 8px。

尺寸

<progress class="progress progress-sm" value="30" max="100" aria-label="Small">30%</progress><progress class="progress" value="55" max="100" aria-label="Medium">55%</progress><progress class="progress progress-lg" value="80" max="100" aria-label="Large">80%</progress>
<>  <progress className="progress progress-sm" value="30" max="100" aria-label="Small">30%</progress>  <progress className="progress" value="55" max="100" aria-label="Medium">55%</progress>  <progress className="progress progress-lg" value="80" max="100" aria-label="Large">80%</progress></>
<progress class="progress progress-sm" value="30" max="100" aria-label="Small">30%</progress><progress class="progress" value="55" max="100" aria-label="Medium">55%</progress><progress class="progress progress-lg" value="80" max="100" aria-label="Large">80%</progress>
<template>  <progress class="progress progress-sm" value="30" max="100" aria-label="Small">30%</progress>  <progress class="progress" value="55" max="100" aria-label="Medium">55%</progress>  <progress class="progress progress-lg" value="80" max="100" aria-label="Large">80%</progress></template>

#分段

progress-segmented 將軌道切成等長區段,適合以項目數量表示的進度,例如已完成 5 個步驟中的 3 個,或已上傳 8 個檔案中的 4 個。將 --progress-steps 設為與 max 相同的數值,讓每一段對應一個步驟。分段遮罩同時套用到軌道和填色,讓各區段與進度值對齊。

分段

<label class="field">  Step 3 of 5 <progress class="progress progress-segmented" max="5" value="3">Step 3 of 5</progress></label><label class="field">  5 of 8 files uploaded <progress class="progress progress-segmented progress-lg" style="--progress-steps: 8" max="8" value="5">    5 of 8  </progress></label>
<>  <label className="field">    Step 3 of 5 <progress className="progress progress-segmented" max="5" value="3">Step 3 of 5</progress>  </label>  <label className="field">    5 of 8 files uploaded <progress className="progress progress-segmented progress-lg" style={{ '--progress-steps': '8' } as React.CSSProperties} max="8" value="5">      5 of 8    </progress>  </label></>
<label class="field">  Step 3 of 5 <progress class="progress progress-segmented" max="5" value="3">Step 3 of 5</progress></label><label class="field">  5 of 8 files uploaded <progress class="progress progress-segmented progress-lg" style="--progress-steps: 8" max="8" value="5">    5 of 8  </progress></label>
<template>  <label class="field">    Step 3 of 5 <progress class="progress progress-segmented" max="5" value="3">Step 3 of 5</progress>  </label>  <label class="field">    5 of 8 files uploaded <progress class="progress progress-segmented progress-lg" style="--progress-steps: 8" max="8" value="5">      5 of 8    </progress>  </label></template>

#環形

progress-ring 將相同的進度值繪製在圓形軌道上,適合放在方塊、一列內容或卡片角落。請使用帶有 role="progressbar" 的元素。瀏覽器若支援具型別的 attr(),圓環會直接讀取 aria-valuenow 和 aria-valuemax,因此只需設定一次數值,輔助技術和圓環繪圖就能共用,弧線也會平滑過渡到新數值。其他瀏覽器還需要在 style 屬性中設定 --progress-ring-value。

元素本身的內容會顯示為中央標籤。弧線兩端都是圓角,進度為零時只顯示空軌道。

環形

<div class="progress-ring progress-ring-sm" role="progressbar" aria-label="Upload" aria-valuenow="40"></div><div class="progress-ring" role="progressbar" aria-label="Storage used" aria-valuenow="64">64</div><div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Steps done" aria-valuenow="3" aria-valuemax="8" aria-valuetext="3 of 8">  3/8</div><div class="progress-ring progress-ring-xl" role="progressbar" aria-label="Coverage" aria-valuenow="86">  86%</div>
<>  <div className="progress-ring progress-ring-sm" role="progressbar" aria-label="Upload" aria-valuenow={40}></div>  <div className="progress-ring" role="progressbar" aria-label="Storage used" aria-valuenow={64}>    64  </div>  <div className="progress-ring progress-ring-lg" role="progressbar" aria-label="Steps done" aria-valuenow={3} aria-valuemax={8} aria-valuetext="3 of 8">    3/8  </div>  <div className="progress-ring progress-ring-xl" role="progressbar" aria-label="Coverage" aria-valuenow={86}>    86%  </div></>
<div class="progress-ring progress-ring-sm" role="progressbar" aria-label="Upload" aria-valuenow="40"></div><div class="progress-ring" role="progressbar" aria-label="Storage used" aria-valuenow="64">64</div><div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Steps done" aria-valuenow="3" aria-valuemax="8" aria-valuetext="3 of 8">  3/8</div><div class="progress-ring progress-ring-xl" role="progressbar" aria-label="Coverage" aria-valuenow="86">  86%</div>
<template>  <div class="progress-ring progress-ring-sm" role="progressbar" aria-label="Upload" aria-valuenow="40"></div>  <div class="progress-ring" role="progressbar" aria-label="Storage used" aria-valuenow="64">    64  </div>  <div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Steps done" aria-valuenow="3" aria-valuemax="8" aria-valuetext="3 of 8">    3/8  </div>  <div class="progress-ring progress-ring-xl" role="progressbar" aria-label="Coverage" aria-valuenow="86">    86%  </div></template>

省略 aria-valuenow 表示進度未知,此時四分之一圈長的弧線會沿著軌道移動。若圓環需要表示狀態,請將 --progress-ring-color 設為對應的狀態色,並在旁邊以文字標示狀態。

環形狀態

<div class="progress-ring" role="progressbar" aria-label="Preparing"></div><div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Checks passed" aria-valuenow="100" style="--progress-ring-color: var(--color-success)">  100</div><div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Quota used" aria-valuenow="92" style="--progress-ring-color: var(--color-danger)">  92</div>
<>  <div className="progress-ring" role="progressbar" aria-label="Preparing"></div>  <div className="progress-ring progress-ring-lg" role="progressbar" aria-label="Checks passed" aria-valuenow={100} style={{ '--progress-ring-color': 'var(--color-success)' } as React.CSSProperties}>    100  </div>  <div className="progress-ring progress-ring-lg" role="progressbar" aria-label="Quota used" aria-valuenow={92} style={{ '--progress-ring-color': 'var(--color-danger)' } as React.CSSProperties}>    92  </div></>
<div class="progress-ring" role="progressbar" aria-label="Preparing"></div><div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Checks passed" aria-valuenow="100" style="--progress-ring-color: var(--color-success)">  100</div><div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Quota used" aria-valuenow="92" style="--progress-ring-color: var(--color-danger)">  92</div>
<template>  <div class="progress-ring" role="progressbar" aria-label="Preparing"></div>  <div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Checks passed" aria-valuenow="100" style="--progress-ring-color: var(--color-success)">    100  </div>  <div class="progress-ring progress-ring-lg" role="progressbar" aria-label="Quota used" aria-valuenow="92" style="--progress-ring-color: var(--color-danger)">    92  </div></template>

#顯示數值

進度條本身不會顯示數值。請在標籤旁用等寬數字顯示,避免數值更新時位置跳動。

顯示數值

<div class="flex flex-col gap-xs">  <div class="flex items-baseline justify-between text-sm">    <span class="fg-text-strong" id="backup-label">Uploading the backup</span>    <span class="fg-text-muted">7.4 of 10 GB</span>  </div>  <progress class="progress" value="7.4" max="10" aria-labelledby="backup-label">74%</progress></div>
<div className="flex flex-col gap-xs">  <div className="flex items-baseline justify-between text-sm">    <span className="fg-text-strong" id="backup-label">Uploading the backup</span>    <span className="fg-text-muted">7.4 of 10 GB</span>  </div>  <progress className="progress" value="7.4" max="10" aria-labelledby="backup-label">74%</progress></div>
<div class="flex flex-col gap-xs">  <div class="flex items-baseline justify-between text-sm">    <span class="fg-text-strong" id="backup-label">Uploading the backup</span>    <span class="fg-text-muted">7.4 of 10 GB</span>  </div>  <progress class="progress" value="7.4" max="10" aria-labelledby="backup-label">74%</progress></div>
<template>  <div class="flex flex-col gap-xs">    <div class="flex items-baseline justify-between text-sm">      <span class="fg-text-strong" id="backup-label">Uploading the backup</span>      <span class="fg-text-muted">7.4 of 10 GB</span>    </div>    <progress class="progress" value="7.4" max="10" aria-labelledby="backup-label">74%</progress>  </div></template>

#進度末端的標記

progress-label 包含進度條,以及一個跟著填色末端移動的 progress-marker:數值顯示在一個小面板上,面板的尖角指向填色末端。尖角沿進度條移動時,面板也會相對尖角滑動,讓尖角在面板上的相對位置對應進度比例。即使在 0% 或 100% 時,面板也會維持在進度條兩端之內,不會超出容器。進度條上方會為它預留空間;使用 progress-label-below 則改為預留在下方。

進度末端的標記

<div class="progress-label" style="--progress-value: 62">  <progress class="progress" value="62" max="100" aria-label="Uploading the archive">62%</progress>  <span class="progress-marker" aria-hidden="true">62%</span></div><div class="progress-label progress-label-below" style="--progress-value: 96">  <progress class="progress" value="96" max="100" aria-label="Indexing">96%</progress>  <span class="progress-marker" aria-hidden="true">96%</span></div>
<>  <div className="progress-label" style={{ '--progress-value': '62' } as React.CSSProperties}>    <progress className="progress" value="62" max="100" aria-label="Uploading the archive">      62%    </progress>    <span className="progress-marker" aria-hidden="true">62%</span>  </div>  <div className="progress-label progress-label-below" style={{ '--progress-value': '96' } as React.CSSProperties}>    <progress className="progress" value="96" max="100" aria-label="Indexing">96%</progress>    <span className="progress-marker" aria-hidden="true">96%</span>  </div></>
<div class="progress-label" style="--progress-value: 62">  <progress class="progress" value="62" max="100" aria-label="Uploading the archive">62%</progress>  <span class="progress-marker" aria-hidden="true">62%</span></div><div class="progress-label progress-label-below" style="--progress-value: 96">  <progress class="progress" value="96" max="100" aria-label="Indexing">96%</progress>  <span class="progress-marker" aria-hidden="true">96%</span></div>
<template>  <div class="progress-label" style="--progress-value: 62">    <progress class="progress" value="62" max="100" aria-label="Uploading the archive">      62%    </progress>    <span class="progress-marker" aria-hidden="true">62%</span>  </div>  <div class="progress-label progress-label-below" style="--progress-value: 96">    <progress class="progress" value="96" max="100" aria-label="Indexing">96%</progress>    <span class="progress-marker" aria-hidden="true">96%</span>  </div></template>

語意由進度條提供,標記則加上 aria-hidden;請將 --progress-value 設為進度條數值的百分比,並寫在 value 旁邊,就像渲染程式會同時輸出兩者一樣。不確定進度的進度條沒有數值,因此不會顯示標記。標記會隨填色平滑移動;啟用減少動態效果時則直接跳到定位。

#半環形

progress-ring-half 沿著拱形(圓環的上半部)繪製數值,數字放在拱形之中,適合呈現分數、配額或目標達成比例。拱形兩端和弧線末端都是圓角。沒有 aria-valuenow 時數值未知,會有占拱形四分之一長度的弧段從一端移動到另一端。

半環形

<div class="progress-ring progress-ring-half progress-ring-xl" role="progressbar" aria-label="Storage used" aria-valuenow="72" style="--progress-ring-value: 72">  72%</div><div class="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Seats taken" aria-valuenow="18" aria-valuemax="40" style="--progress-ring-value: 18; --progress-ring-max: 40">  18</div><div class="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Estimating"></div>
<>  <div className="progress-ring progress-ring-half progress-ring-xl" role="progressbar" aria-label="Storage used" aria-valuenow={72} style={{ '--progress-ring-value': '72' } as React.CSSProperties}>    72%  </div>  <div className="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Seats taken" aria-valuenow={18} aria-valuemax={40} style={{ '--progress-ring-value': '18', '--progress-ring-max': '40' } as React.CSSProperties}>    18  </div>  <div className="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Estimating"></div></>
<div class="progress-ring progress-ring-half progress-ring-xl" role="progressbar" aria-label="Storage used" aria-valuenow="72" style="--progress-ring-value: 72">  72%</div><div class="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Seats taken" aria-valuenow="18" aria-valuemax="40" style="--progress-ring-value: 18; --progress-ring-max: 40">  18</div><div class="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Estimating"></div>
<template>  <div class="progress-ring progress-ring-half progress-ring-xl" role="progressbar" aria-label="Storage used" aria-valuenow="72" style="--progress-ring-value: 72">    72%  </div>  <div class="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Seats taken" aria-valuenow="18" aria-valuemax="40" style="--progress-ring-value: 18; --progress-ring-max: 40">    18  </div>  <div class="progress-ring progress-ring-half progress-ring-lg" role="progressbar" aria-label="Estimating"></div></template>

#無障礙

  • 使用 field 的標籤、aria-label 或 aria-labelledby 為進度條命名。
  • <progress> 內的文字會在瀏覽器無法繪製該元素時作為替代內容。
  • 若進度條表示某個區域的載入進度,請在該區域設定 aria-busy="true",直到載入完成。

#類別

類別說明
progress使用附有標籤的原生 progress 元素呈現進度條。前景色沿著 6px 高的軌道填至目前進度,並平順過渡到每個新數值。元素內的文字是備援內容。
progress-sm4px 的軌道,適用於清單項目。預設為 6px。搭配 progress 使用
progress-lg軌道尺寸為 8px,預設為 6px搭配 progress 使用
progress-segmented將軌道等分為 --progress-steps 段,預設為五段,用來呈現項目數量。請將 --progress-steps 設為與 max 相同的數值搭配 progress 使用
progress-label容納一個進度條,以及位於其填色末端上方的 progress-marker,並在進度條上方為標記保留空間。請將 --progress-value 設為進度條數值的百分比
progress-label-below將標記放在進度條下方,而不是上方搭配 progress-label 使用
progress-marker放在小面板上的數值,面板的尖角指向填色末端;面板會在尖角下方滑動,因此始終留在進度條兩端之內。請以 aria-hidden 隱藏它:數量由進度條表達。不確定狀態的進度條不會顯示標記
progress-ring直徑 40px 的圓環。元素須設定 role="progressbar",提供無障礙名稱,並將目前進度填入 aria-valuenow。元素內容會顯示為圓環中央的標籤。
progress-ring-half沿著拱形(圓環的上半部)繪製數量,兩端為圓角,數值放在拱形之中。沒有 aria-valuenow 時,會有占拱形四分之一長度的弧段從一端移動到另一端搭配 progress-ring 使用
progress-ring-sm20px 的圓環,預設為 40px搭配 progress-ring 使用
progress-ring-lg64px 的圓環,預設為 40px搭配 progress-ring 使用
progress-ring-xl96px 的圓環,中央數字較大。預設為 40px。搭配 progress-ring 使用

#自訂屬性

屬性預設值說明
--progress-height.375rem軌道粗細設定於 progress
--progress-colorvar(--color-surface-inverse)填色設定於 progress
--progress-steps5分段軌道的區段數,請設為與 max 相同的值設定於 progress-segmented
--progress-value0進度條數值占最大值的百分比,供標記使用:由頁面寫在進度條的值旁邊設定於 progress-label
--progress-ring-value進度環的數值。支援具型別的 attr() 時取自 aria-valuenow,其他情況請手動設定設定於 progress-ring
--progress-ring-max100整個圓環代表的最大值。支援具型別的 attr() 時,從 aria-valuemax 取得,其他情況請手動設定設定於 progress-ring
--progress-ring-size2.5rem環的直徑設定於 progress-ring
--progress-ring-widthmax(2px, calc(var(--progress-ring-size) / 10))環的線寬為尺寸的十分之一,最小為 2px設定於 progress-ring
--progress-ring-colorvar(--color-surface-inverse)圓弧的顏色。圓環用來呈現狀態時,請設為對應的狀態色設定於 progress-ring

#原始碼

@master/ui/components/progress.css
/* * Progress: a native <progress> drawn as a thin well that fills with ink. * Without a value it is indeterminate: a band of ink travels along the track. * A ring draws the same amount around a circle, for a tile, a row or the corner of a card; a half ring draws * it along an arch, with the figure standing in the arch. * * progress-label holds a bar and a marker that rides the end of its fill: a small sheet with the figure and a * point that touches the end. The marker slides along under the point, as far as the point is along the bar, * so at 0 and at 100 it stays inside the bar's ends and never leaves its container. The bar is still the * semantics; the marker is aria-hidden and reads --progress-value, the same amount, which the page writes * beside the bar's value. An indeterminate bar has no amount, so its marker is not shown. */@property --progress-ring-value {  syntax: '<number>';  inherits: true;  initial-value: 0;}@property --progress-ring-from {  syntax: '<number>';  inherits: true;  initial-value: 0;}@layer components.ui {  .progress {    --progress-height: .375rem;    --progress-color: var(--color-surface-inverse);    display: block;    width: 100%;    height: var(--progress-height);    margin: 0;    border: 0;    border-radius: 999px;    overflow: hidden;    background: var(--color-surface-inset);    box-shadow: var(--shadow-pressed);    vertical-align: middle;    appearance: none;    &::-webkit-progress-bar {      background: transparent;    }    /* The fill keeps a round end and eases to each new value. */    &::-webkit-progress-value {      border-radius: 999px;      background: var(--progress-color);      transition: inline-size var(--duration-base) var(--easing-glide);    }    &::-moz-progress-bar {      border-radius: 999px;      background: var(--progress-color);    }    &:indeterminate {      background:        linear-gradient(90deg, transparent, var(--progress-color) 30%, var(--progress-color) 70%, transparent) 0 0 / 40% 100% no-repeat,        var(--color-surface-inset);      /* Linear: an eased loop would rest at its ends, where the band is outside the track. */      animation: progress-travel 1.2s linear infinite;    }    &:indeterminate::-webkit-progress-value {      background: transparent;    }    &:indeterminate::-moz-progress-bar {      background: transparent;    }    /* Right to left, the band travels the way the bar fills. */    &:indeterminate:dir(rtl) {      animation-direction: reverse;    }    &.progress-sm { --progress-height: .25rem; }    &.progress-lg { --progress-height: .5rem; }    /*     * Segmented: the track is cut into --progress-steps equal pieces, for a count of things: four of five     * steps, three of four checks. The cut is a mask over the well and its fill alike, so the pieces stay     * in step with each other; their ends are square and the track's own corner is small to match.     */    &.progress-segmented {      --progress-steps: 5;      --progress-gap: 3px;      border-radius: 1.5px;      /* A piece that is still empty is counted too, so the well takes a tint of the fill and holds on any surface. */      background: color-mix(in oklab, var(--progress-color) 20%, var(--color-surface-inset));      mask: linear-gradient(90deg, black calc(100% - var(--progress-gap)), transparent 0) 0 0 / calc((100% + var(--progress-gap)) / var(--progress-steps)) 100%;      &::-webkit-progress-value {        border-radius: 0;      }      &::-moz-progress-bar {        border-radius: 0;      }    }    @media (prefers-reduced-motion: reduce) {      &::-webkit-progress-value {        transition: none;      }      /* Without travel, an even half tone says the amount is unknown. */      &:indeterminate {        background: color-mix(in oklab, var(--progress-color) 30%, var(--color-surface-inset));        animation: none;      }    }    @media (forced-colors: active) {      --progress-color: Highlight;      outline: 1px solid CanvasText;      outline-offset: -1px;      forced-color-adjust: none;      background: Canvas;      /* A piece not yet reached is the system's gray, as a ring's track is; the inset tint would be an author color. */      &.progress-segmented {        background-color: GrayText;      }      /* The band travels over the canvas, not over the author's well, which the rule above it would otherwise keep. */      &:indeterminate {        background-color: Canvas;      }      @media (prefers-reduced-motion: reduce) {        &:indeterminate {          background: GrayText;        }      }    }  }  /*   * A bar with a marker over its end, or under it with progress-label-below. The room for the marker is kept   * above or below the bar, so the marker never covers what stands next to it.   */  .progress-label {    --progress-value: 0;    --progress-marker-height: 1.5rem;    --progress-marker-gap: .5rem;    position: relative;    display: block;    min-width: 0;    padding-block-start: calc(var(--progress-marker-height) + var(--progress-marker-gap));    &.progress-label-below {      padding-block: 0 calc(var(--progress-marker-height) + var(--progress-marker-gap));    }    /* No amount, no figure. */    &:has(.progress:indeterminate) {      padding-block: 0;      .progress-marker {        display: none;      }    }  }  /*   * The figure over the end of the fill: a small sheet whose point touches the end. The point sits as far along   * the sheet as the end is along the bar, so the sheet slides under it and stays inside the bar's ends.   */  .progress-marker {    --progress-marker-at: clamp(0, var(--progress-value), 100);    position: absolute;    inset-block-start: 0;    inset-inline-start: calc(var(--progress-marker-at) * 1%);    display: inline-grid;    place-items: center;    box-sizing: border-box;    height: var(--progress-marker-height);    padding: 0 .5rem;    translate: calc(var(--progress-marker-at) * -1%) 0;    border-radius: calc(var(--radius-control-sm) * var(--corner-scale));    corner-shape: var(--corner-shape);    @apply --surface-sheet;    color: var(--color-text-strong);    box-shadow: var(--shadow-raised);    font: var(--font-weight-control) .75rem/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    white-space: nowrap;    transition-property: inset-inline-start, translate;    transition-duration: var(--duration-base);    transition-timing-function: var(--easing-glide);    &:dir(rtl) {      translate: calc(var(--progress-marker-at) * 1%) 0;    }    /*     * The point: a small square turned on its corner, the sheet's own face, with a contour on its two lower     * sides only, so it grows out of the sheet without a seam. It stays a point's width in from the corners.     */    &::after {      content: '';      position: absolute;      inset-block-start: calc(100% - .25rem);      inset-inline-start: clamp(.5rem, calc(var(--progress-marker-at) * 1%), calc(100% - .5rem));      width: .5rem;      height: .5rem;      translate: -50% 0;      rotate: 45deg;      background: var(--color-surface-raised-low);      box-shadow: inset -.5px -.5px 0 var(--color-line-contour);    }    &:dir(rtl)::after {      translate: 50% 0;    }    .progress-label-below & {      inset-block: auto 0;      &::after {        inset-block: auto calc(100% - .25rem);        background: var(--color-surface-raised);        box-shadow: inset .5px .5px 0 var(--color-line-contour);      }    }    @media (prefers-reduced-motion: reduce) {      transition: none;    }    @media (forced-colors: active) {      outline: 1px solid CanvasText;      outline-offset: -1px;      &::after {        display: none;      }    }  }  /*   * Ring: an element with role="progressbar". Where the browser supports typed attr(), the ring reads   * aria-valuenow and aria-valuemax itself, so the amount is written once, for people and for the drawing;   * elsewhere set --progress-ring-value. Both ends of the arc are round, and the arc eases to each new value.   * Without aria-valuenow the amount is unknown: a quarter arc travels the track.   * The element's own content is the label in the middle.   */  .progress-ring {    --progress-ring-size: 2.5rem;    --progress-ring-width: max(2px, calc(var(--progress-ring-size) / 10));    --progress-ring-color: var(--color-surface-inverse);    --progress-ring-track: color-mix(in oklab, var(--progress-ring-color) 11%, transparent);    --progress-ring-max: 100;    /* As far round as the amount is of the whole, held between nothing and all of it, as a gauge's share is. */    --progress-ring-turn: clamp(0, calc(var(--progress-ring-value) / var(--progress-ring-max)), 1);    position: relative;    display: inline-grid;    flex: none;    place-items: center;    width: var(--progress-ring-size);    height: var(--progress-ring-size);    color: var(--color-text-strong);    font: var(--font-weight-control) calc(var(--progress-ring-size) * .27)/1 var(--font-family-sans);    font-feature-settings: inherit;    font-variant-numeric: tabular-nums;    letter-spacing: -.01em;    vertical-align: middle;    transition: --progress-ring-value var(--duration-base) var(--easing-glide);    @supports (x: attr(x type(*))) {      &[aria-valuenow] {        --progress-ring-value: attr(aria-valuenow type(<number>), 0);      }      &[aria-valuemax] {        --progress-ring-max: attr(aria-valuemax type(<number>), 100);      }    }    /*     * The drawing: an arc from a conic gradient, a dot at each end to round it, and a mask that keeps the ring.     * The dots have no radius at zero, so an empty ring is an empty track.     */    &::before {      --progress-ring-radius: calc((var(--progress-ring-size) - var(--progress-ring-width)) / 2);      --progress-ring-cap: calc(var(--progress-ring-width) / 2 * min(1, var(--progress-ring-turn) * 200));      content: '';      position: absolute;      inset: 0;      border-radius: 999px;      background:        radial-gradient(circle at 50% calc(var(--progress-ring-width) / 2), var(--progress-ring-color) calc(var(--progress-ring-cap) - .5px), transparent var(--progress-ring-cap)),        radial-gradient(circle at calc(50% + var(--progress-ring-radius) * sin(var(--progress-ring-turn) * 360deg)) calc(50% - var(--progress-ring-radius) * cos(var(--progress-ring-turn) * 360deg)), var(--progress-ring-color) calc(var(--progress-ring-cap) - .5px), transparent var(--progress-ring-cap)),        conic-gradient(var(--progress-ring-color) calc(var(--progress-ring-turn) * 360deg), var(--progress-ring-track) 0);      mask: radial-gradient(farthest-side, transparent calc(100% - var(--progress-ring-width) - .5px), black calc(100% - var(--progress-ring-width)), black calc(100% - .5px), transparent);    }    &:not([aria-valuenow]) {      --progress-ring-value: 25;      --progress-ring-max: 100;      &::before {        animation: progress-ring-travel .9s linear infinite;      }    }    /*     * Half: the amount along an arch, from its start to its end, with the figure standing in the arch. The arch     * is the top half of the ring; its two ends and the end of the arc are round. The track's start takes the     * arc's color while the arc begins there and holds any amount, so the arc begins with a round end too.     */    &.progress-ring-half {      height: calc(var(--progress-ring-size) / 2 + var(--progress-ring-width) / 2);      place-items: end center;      font-size: calc(var(--progress-ring-size) * .2);      &::before {        --progress-ring-radius: calc((var(--progress-ring-size) - var(--progress-ring-width)) / 2);        --progress-ring-from-angle: calc(var(--progress-ring-from) * 180deg - 90deg);        --progress-ring-to-angle: calc((var(--progress-ring-from) + var(--progress-ring-turn)) * 180deg - 90deg);        --progress-ring-start: color-mix(in oklab, var(--progress-ring-color) calc(min(1, var(--progress-ring-turn) * 1000) * (1 - min(1, var(--progress-ring-from) * 1000)) * 100%), var(--progress-ring-track));        inset: 0 0 auto;        height: var(--progress-ring-size);        background:          radial-gradient(circle at calc(50% + var(--progress-ring-radius) * sin(var(--progress-ring-from-angle))) calc(50% - var(--progress-ring-radius) * cos(var(--progress-ring-from-angle))), var(--progress-ring-color) calc(var(--progress-ring-cap) - .5px), transparent var(--progress-ring-cap)),          radial-gradient(circle at calc(50% + var(--progress-ring-radius) * sin(var(--progress-ring-to-angle))) calc(50% - var(--progress-ring-radius) * cos(var(--progress-ring-to-angle))), var(--progress-ring-color) calc(var(--progress-ring-cap) - .5px), transparent var(--progress-ring-cap)),          conic-gradient(from -90deg,            var(--progress-ring-track) 0 calc(var(--progress-ring-from) * 180deg),            var(--progress-ring-color) 0 calc((var(--progress-ring-from) + var(--progress-ring-turn)) * 180deg),            var(--progress-ring-track) 0 200deg,            transparent 0 340deg,            var(--progress-ring-start) 0);        mask:          radial-gradient(circle at 50% 100%, transparent calc(var(--progress-ring-radius) - var(--progress-ring-width) / 2 - .5px), black calc(var(--progress-ring-radius) - var(--progress-ring-width) / 2), black calc(var(--progress-ring-radius) + var(--progress-ring-width) / 2 - .5px), transparent calc(var(--progress-ring-radius) + var(--progress-ring-width) / 2)) top / 100% 50% no-repeat,          radial-gradient(circle at calc(var(--progress-ring-width) / 2) 50%, black calc(var(--progress-ring-width) / 2 - .5px), transparent calc(var(--progress-ring-width) / 2)),          radial-gradient(circle at calc(100% - var(--progress-ring-width) / 2) 50%, black calc(var(--progress-ring-width) / 2 - .5px), transparent calc(var(--progress-ring-width) / 2));        border-radius: 0;      }      /* No amount: a quarter of the arch travels from one end to the other and back. */      &:not([aria-valuenow])::before {        animation: progress-half-travel 1.4s var(--easing-glide) infinite alternate;      }    }    &.progress-ring-sm {      --progress-ring-size: 1.25rem;      --progress-ring-width: 2.5px;    }    &.progress-ring-lg {      --progress-ring-size: 4rem;      --progress-ring-width: 5px;    }    &.progress-ring-xl {      --progress-ring-size: 6rem;      --progress-ring-width: 6px;      font-size: 1.375rem;      letter-spacing: -.02em;    }    @media (prefers-reduced-motion: reduce) {      transition: none;      &:not([aria-valuenow])::before,      &.progress-ring-half:not([aria-valuenow])::before {        animation-duration: 2.4s;      }    }    /* Kept out of forced colors for the drawing, so the figure in the middle takes the system's text color itself. */    @media (forced-colors: active) {      --progress-ring-color: Highlight;      --progress-ring-track: GrayText;      forced-color-adjust: none;      color: CanvasText;    }  }}@keyframes progress-half-travel {  from {    --progress-ring-from: 0;  }  to {    --progress-ring-from: .75;  }}@keyframes progress-ring-travel {  to {    rotate: 360deg;  }}@keyframes progress-travel {  from {    background-position: -67% 0, 0 0;  }  to {    background-position: 167% 0, 0 0;  }}