ProgressBar draft
The thin bar that tells how far a task has got: a 4px border/soft track holding an accent fill whose length is value / max. Always announced as a named progressbar with a readable value; no states, no animation — the parent places it and prints the counter beside it.
Variants: — · A11y: pending
No states: nothing hovers, nothing focuses (RFC §3.3). value is clamped to [0, max]; a max ≤ 0 or a non-finite value draws an empty fill and announces 0 (RFC §3.5 point 5). The fill is an aria-hidden SVG rect whose width attribute is value / max — no inline style (RFC §3.4).
Examples
Live renders — hover and keyboard states all work here.
<ProgressBar value={8} max={10} label="Ready for ranked" valueText="8 of 10 validated" />
<ProgressBar value={620} max={1000} label="Level 14 experience" valueText="620 of 1000 XP" />
<ProgressBar value={1} max={8} label="Quiz progress" valueText="Question 1 of 8" />
<ProgressBar value={0} max={10} label="Ready for ranked" valueText="0 of 10 validated" />
Guidelines
Golden rules
- Always a text counter beside the bar. The track (border/soft) is barely visible against the page, so the bar never carries the value alone: print the count as text next to it — '8/10', '620 / 1000 XP', 'Q 01 / 08' (RFC §4.3, §7 checkpoint). The counter is product copy, product-side.
- Always named, always read. Exactly one of label (text) or labelledBy (the id of visible text — preferred when a heading already names the task), and a valueText said the way a person says it: '8 of 10 validated', never a bare percentage (RFC §3.1, §7 Q5, §7 checkpoint).
- Progress, not measurement. A task that moves toward done — a checklist, a level, a quiz. A ranking or a score among others is a measurement and stays product-side (RFC §7 Q1).
- One height, one tone, no motion. 4px (s-05), the live accent on border/soft, square ends; the fill takes its new length at once (RFC §7 Q2–Q4).
Do
- Point labelledBy at the heading or caption that already names the task on screen; give that element an id (RFC §2.3).
- Keep valueText in step with the visible counter — the quiz bar shows question 1 as 1 / 8, the same as its 'Q 01 / 08' (RFC §7 Q6).
- Give the bar the width you want through its parent (a column, flex: 1); it fills the width it is given (RFC §3.4).
- Set data-accent / data-role on an ancestor to change the fill colour; the track stays neutral (RFC §3.4).
Don't
- Don't pass both label and labelledBy, or neither — the type refuses it, and axe reds a nameless bar (RFC §4.3).
- Don't use it for a score or a ranking among several items (RFC §7 Q1).
- Don't add a transition, a radius, a margin or a height product-side — one recipe (RFC §7 Q2, Q4).
The 5 accents
Each tile scopes the accent axis with data-accent on the tile itself — the element-scoped theme contract.
ambre
bleu
rouge
violet
jade
Props
| Prop | Type | Default | Optional | Note |
|---|---|---|---|---|
value |
number |
— | no | how far the task has got, in the unit of max; clamped to [0, max] for the fill and aria-valuenow alike; a non-finite value draws an empty fill and announces 0 (RFC §3.1, §3.4, §3.5 point 5) |
max |
number |
— | no | the total, no default (RFC §3.1); aria-valuemin is always 0. A max ≤ 0 or non-finite draws an empty fill and announces 0 of 0 (§3.5 point 5) |
valueText |
string |
— | no | the value as a person says it → aria-valuetext, on every render: '8 of 10 validated', 'Question 1 of 8'. Required (RFC §3.1, §7 checkpoint « PB texte lu: Obligatoire ») |
label |
string |
— | yes | accessible name as text → aria-label. Exactly one of label / labelledBy: the props type is a union that refuses both and neither (RFC §3.1, §7 Q5) |
labelledBy |
string |
— | yes | id of visible text that names the bar → aria-labelledby; preferred when the heading or caption is already on screen. Exactly one of label / labelledBy (RFC §3.1) |
Accessibility pending
- Semantic structure
- Exactly one <div class="ll-progress-bar" role="progressbar"> carrying an accessible name (aria-label from label, or aria-labelledby from labelledBy — exactly one), aria-valuemin="0", aria-valuemax, aria-valuenow (the clamped value) and aria-valuetext (valueText, required) on every render (RFC §3.4, §4.1). Its only child is an aria-hidden <svg> holding one <rect class="ll-progress-bar-fill"> whose width attribute is value / max; no text of its own. Always announced — no decorative mode (§7 Q5). No live region: a value changes as the result of the user's own action and is read on request.
- Keyboard
- Nothing to do: a progressbar is not interactive and nothing is focusable — no a, button, input or tabindex is rendered by the component (RFC §3.3, §4.2); the local suite asserts it.
- Decisions
- Name enforced twice: by the props type, and by axe's aria-progressbar-name (wcag2a), which the local suite locks under the gate's own configuration (a nameless bar is red, a named one passes — RFC §4.3, L10). Contrast pair declared in contrast-pairs.json: Semantic/accent/default on Semantic/border/soft at ui-component (3:1, WCAG 1.4.11), scored once per accent by the contrast gate. The track's end against the page (border/soft, 1.14:1 on surface/default) is not a 3:1 boundary: accepted at the checkpoint with the guideline that a visible text counter sits beside every bar, so the bar is never the only carrier of the value (§4.3, §7 checkpoint). No motion, so no reduced-motion guard is owed (§7 Q4). A div with role rather than a native <progress>, whose engine-specific pseudo-elements the no-reset distribution contract would have to neutralise (§4.1).
- Notes
- Implemented per RFC §4; this status moves to pass only through the accessibility engine gate, never by assertion.