Status Strip
A row of equal segments over time, such as one segment for each hour or day, each shaded by its share of the time in one state. A segment with no data is empty between two lines, so it does not read as 0.
When to use
- Show when something was in one state over time, such as in stock or up, as a row of equal segments for each hour or day.
- Prefer
ProgressBarto show one value, such as how much of a task is complete. - Prefer
BarChartwhen a reader must read exact values over time from axes and a tooltip.
Shares between 0 and 1
A segment can cover more than one reading, such as six hours of a 30-day range. Pass the share of those readings in the state as value. The fill starts at 35% strength above 0, so one hour in six still shows, and grows to full strength at 1.
No data
Pass value={null} for a segment with no reading. It is empty between two lines, at its top and bottom, and a segment at 0 fills with the track color. Never pass 0 for a segment with no data: a reader then sees a sold-out or down hour that nobody measured.
Beside text that says the same thing
When text beside the strip already gives its summary, pass aria-hidden in place of a name, so a screen reader does not read the same thing twice. Set the segment width with an auto-cols-* class, so each segment keeps its width when the number of segments changes.
Colors
The fill is --color-accent-600, and the track is --color-gray-300. Set --status-strip-fill or --status-strip-track on StatusStrip.Root to change them for every segment.
Threshold colors
To color one segment by a threshold, such as a weak day, set --status-strip-fill on that segment. A segment at 0 paints --status-strip-track, so set that variable to recolor a sold-out day. A bg-* class on a segment replaces the fill above 0, and a data-[share=none]: class replaces the paint at 0.
In a list
A strip has no state, effects, listeners, or layout reads, so it renders on the server, and hydration only renders it again. A list of strips needs no wrapper part. Give each row its own text, and pass aria-hidden when that text says what the strip shows.
Many segments
A strip fills its width by default, so it can hold a segment for each hour of a week. Keep the default 1px gap at that density, so the strip fits a 320px screen. At that width, neighboring hours in the same state can run together. When each hour must stay separate on a narrow screen, show a segment for each day.
Composition
Polymorphism
StatusStrip.Root and StatusStrip.Segment take asChild. Use it on StatusStrip.Root to render the strip as a <div> in flow content, and on StatusStrip.Segment to render your own element.
Keep each segment non-interactive. A screen reader reads role="img" as one image, so it cannot reach a link or a button inside the strip. Under aria-hidden, such a control still takes keyboard focus, with no name. Put a link to a day's detail outside the strip.
Accessibility
StatusStrip.Rootisrole="img", so a screen reader reads its name as one summary and skips the segments. The type requiresaria-labeloraria-labelledby, oraria-hidden. An empty or blank name throws. UnderasChild, the root's role and name replace the child's own.- With
aria-hidden, the root has no role, and the strip is hidden from assistive technology. Use it only when nearby text says the same thing. - A segment's
titleshows on hover. It is a hint for a pointer, so put what a reader must know in the root's name. When the times matter, such as when stock ran out, list them in text near the strip. - The states differ in strength and in shape (a fill or two lines), not only in hue.
API Reference
StatusStrip.Root
The strip: a full-width <span> grid of equal columns, 1.5rem tall, with a 1px gap. Set the height with h-*, the gap with gap-*, and a fixed segment width with auto-cols-*. It accepts every span prop except role.
StatusStrip.Segment
One segment, such as one hour or one day. It accepts every span prop except children.