Data displaystable.segments
Progress segments
A short row of segments showing how many of a few discrete parts are done ("2 von 4 Sätzen").
Use segments when progress is counted in a few discrete units the athlete recognises: sets of an exercise, sessions of the week. Up to 10 segments; beyond that use a progress bar.
The whole strip is one image for assistive tech (role="img") with a label that states the numbers. By default the label is "{done} von {total} {unit} erledigt"; set unit ("Sätzen", "Trainings") or pass a complete label.
Show the same information as visible text nearby ("4×15 · 2 von 4"), since the segments alone are hard to count at a glance.
Examples
Sets of an exercise
Data
render({
"done": 2,
"total": 4
})Markup
<div class="segments" role="img" aria-label="2 von 4 Sätzen erledigt"><span data-done></span><span data-done></span><span></span><span></span></div>Sessions this week
Data
render({
"done": 3,
"total": 3,
"unit": "Trainings"
})Markup
<div class="segments" role="img" aria-label="3 von 3 Trainings erledigt"><span data-done></span><span data-done></span><span data-done></span></div>Custom label
Data
render({
"done": 1,
"total": 5,
"label": "Runde 2 von 5 läuft"
})Markup
<div class="segments" role="img" aria-label="Runde 2 von 5 läuft"><span data-done></span><span></span><span></span><span></span><span></span></div>Data contract
What render(data) accepts — validated against this JSON Schema in development and tests. Unknown fields are rejected. The same schema is in components.json.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
done | integer | required | — | Completed parts (≤ total).≥ 0 |
total | integer | required | — | Number of parts (max 10). ≥ 1 · ≤ 10 |
unit | string | optional | "Sätzen" | Noun in the dative plural used in the default label ("Sätzen", "Trainings", "Runden"). |
label | string | optional | — | Full accessible label, overriding the default "{done} von {total} {unit} erledigt". |
JSON Schema
{
"type": "object",
"additionalProperties": false,
"required": [
"done",
"total"
],
"properties": {
"done": {
"type": "integer",
"minimum": 0,
"description": "Completed parts (≤ `total`)."
},
"total": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"description": "Number of parts (max 10)."
},
"unit": {
"type": "string",
"default": "Sätzen",
"description": "Noun in the dative plural used in the default label (\"Sätzen\", \"Trainings\", \"Runden\")."
},
"label": {
"type": "string",
"description": "Full accessible label, overriding the default \"{done} von {total} {unit} erledigt\"."
}
}
}Markup & states
Root: div.segments — usable without render() by writing the markup directly.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
role="img" aria-label | text | — | One accessible image with the numbers. |
Parts
| Part | Description |
|---|---|
span / span[data-done] | One 8 px pill per part: done ones --color-accent, open ones --color-surface-2 (design guide §9.7). |
States
| State | Description |
|---|---|
span[data-done] | Completed part. |
Accessibility
- The strip is announced once with its label; individual segments are not separate items.
- Done segments differ by fill and border, not hue alone; the label carries the exact count.
Guidance
Related: Progress bar · Progress ring · Streak strip