Linear Progress With Label
A labelled horizontal progress bar with a live percentage readout above the track.
3 个框架初级
A compact single-row progress bar with a label and percentage, sized for table cells.
<!--
Built for table cells and list rows. min-w-0 on the track lets it shrink inside
a flex row instead of forcing horizontal overflow at 320px, and the label and %
are shrink-0 so only the bar gives up width.
-->
<div class="flex items-center gap-3">
<span class="shrink-0 text-sm text-gray-700 dark:text-gray-300">Onboarding</span>
<div
role="progressbar"
aria-valuenow="42"
aria-valuemin="0"
aria-valuemax="100"
aria-label="Onboarding"
class="h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-gray-200 dark:bg-gray-800"
>
<div class="h-full rounded-full bg-blue-600 dark:bg-blue-500" style="width: 42%"></div>
</div>
<span class="w-9 shrink-0 text-right text-xs font-semibold tabular-nums text-gray-600 dark:text-gray-400">42%</span>
</div>| Prop | 类型 | 默认值 | 说明 |
|---|---|---|---|
label必填 | string | - | 加载时朗读的无障碍标签。 |
value必填 | number | - | 指标的当前值,需预先格式化。 |
min | number | 0 | Min |
max | number | 100 | Max |
className | string | - | 合并到根元素上的额外类名。 |
The track uses `min-w-0 flex-1` so it shrinks inside a flex row instead of overflowing at 320px, while the label and percentage stay `shrink-0`. Drop it straight into list rows or table cells.