Skeleton Loader
Content-shaped placeholders that stand in while data loads.
6 个框架初级
A determinate bar that knows its number and says so.
<!--
DETERMINATE. That word is the entire spec of this component, and it is what
separates it from loader-bar-indeterminate:
aria-valuenow present -> "43% complete" (this component)
aria-valuenow absent -> "busy, unknown" (the indeterminate bar)
So: only set aria-valuenow if you actually know the number. A hardcoded
aria-valuenow="50" on a bar that has no idea is a lie the screen reader will
repeat with total confidence.
role="progressbar" is NOT a live region and browsers do not announce value
changes on their own - the visible percentage is what most sighted users read,
and assistive tech reads the value when the user lands on the bar. Do not add
aria-live to it: a bar ticking 1→100 would fire a hundred announcements.
aria-valuemin/max default to 0/100, but write them anyway - the defaults are
inconsistently implemented, and the day someone switches to bytes the omission
becomes a bug.
-->
<div class="progress">
<div class="progress__head">
<span class="progress__label" id="upload-label">Uploading backup.tar.gz</span>
<span class="progress__value">43%</span>
</div>
<div
class="progress__track"
role="progressbar"
aria-labelledby="upload-label"
aria-valuenow="43"
aria-valuemin="0"
aria-valuemax="100"
>
<div class="progress__fill" style="width: 43%"></div>
</div>
</div>| Prop | 类型 | 默认值 | 说明 |
|---|---|---|---|
value必填 | number | - | 任务的完成进度,从 0 到 100。 |
label | string | 'Uploading' | 加载时朗读的无障碍标签。 |
className | string | - | 合并到根元素上的额外类名。 |
Only use this when you genuinely have the value - a hardcoded aria-valuenow="50" is a lie the screen reader repeats with total confidence, and loader-bar-indeterminate exists precisely for the other case. Write aria-valuemin and aria-valuemax even though they default to 0 and 100; the defaults are patchily implemented and the day someone switches to bytes the omission becomes a bug. Don't add aria-live: role="progressbar" isn't a live region, and making it one turns a 1→100 tick into a hundred announcements.