导航

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-lg8px 轨道,默认为 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进度条进度占 max 的百分比,供标记使用:由页面写在进度条的值旁边在 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;  }}