Source coverage
Per-source status (ok, timed out, as of hh:mm, x of y copied) so a partial result is never shown as empty.
Preview
Partial result One source timed out; the alert says so and the other sources stay listed.
Warning:
Partial result
fileNX did not answer. The results below are from hostNX only.
- hostNXok
- fileNXtimed out
- coproNXas of 14:053 of 10 copied
<div class="nx-coverage">
<div class="nx-alert nx-alert--warning" role="status"
aria-live="polite">
<span class="nx-sr-only">Warning: </span>
<span class="nx-alert__icon" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"
viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-triangle-alert" aria-hidden="true">
<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4
21h16a2 2 0 0 0 1.73-3"></path>
<path d="M12 9v4"></path>
<path d="M12 17h.01"></path>
</svg>
</span>
<div class="nx-alert__body">
<div class="nx-alert__title">Partial result</div>
<p>fileNX did not answer. The results below are from hostNX
only.</p>
</div>
</div>
<div class="nx-coverage__status" role="status"
aria-label="Data sources">
<ul class="nx-coverage__list">
<li class="nx-coverage__item nx-coverage__item--ok"
data-state="ok">
<span class="nx-coverage__source"><bdi>hostNX</bdi></span>
<span class="nx-coverage__state">
<span class="nx-coverage__icon" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" width="14"
height="14" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-check" aria-hidden="true">
<path d="M20 6 9 17l-5-5"></path>
</svg>
</span>
<span>ok</span>
</span>
</li>
<li class="nx-coverage__item nx-coverage__item--timeout"
data-state="timeout">
<span class="nx-coverage__source"><bdi>fileNX</bdi></span>
<span class="nx-coverage__state">
<span class="nx-coverage__icon" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" width="14"
height="14" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-clock" aria-hidden="true">
<circle cx="12" cy="12" r="10"></circle>
<path d="M12 6v6l4 2"></path>
</svg>
</span>
<span>timed out</span>
</span>
</li>
<li class="nx-coverage__item nx-coverage__item--stale"
data-state="stale">
<span class="nx-coverage__source"><bdi>coproNX</bdi></span>
<span class="nx-coverage__state">
<span class="nx-coverage__icon" aria-hidden="true">
<svg xmlns="http://www.w3.org/2000/svg" width="14"
height="14" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round"
class="lucide lucide-history" aria-hidden="true">
<path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74
2.74L3 8"></path>
<path d="M3 3v5h5"></path>
<path d="M12 7v5l4 2"></path>
</svg>
</span>
<span>as of 14:05</span>
</span>
<span class="nx-coverage__progress">
<div class="nx-progress" role="progressbar"
aria-valuenow="30" aria-valuemin="0"
aria-valuemax="100"
aria-label="coproNX: 3 of 10 copied">
<div class="nx-progress__bar" style="width:30%"></div>
</div>
<span class="nx-coverage__count">3 of 10 copied</span>
</span>
</li>
</ul>
</div>
</div><NxSourceCoverage
label="Data sources"
sources={sources}
alert={{
title: "Partial result",
message: "fileNX did not answer.",
}}
/>API
React props (NxKit)
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
label | string | Required | Accessible name of the status region, e.g. "Data sources". | |
sources | NxSourceCoverageItem[] | Required | { id; label; state: "ok"|"pending"|"stale"|"timeout"|"failed"; stateLabel; progress?: { done; total; label }; detail? } | |
alert | { title?: ReactNode; | undefined | Rendered as NxAlert when a source failed or timed out: warning for a partial result, danger when none answered. | |
className | string | undefined | Layout class. |
Classes
| Class | Description |
|---|---|
.nx-coverage | Wrapper: optional NxAlert, then the list |
.nx-coverage__status | role=status region |
.nx-coverage__item | One source; modifier --ok/--pending/--stale/--timeout/--failed |
.nx-coverage__progress | NxProgress bar + visible count |
States
all ok
- hostNXok
- fileNXok
none answered
Error:
No source answered
Nothing could be loaded. This is not an empty list.
- hostNXfailed
- fileNXtimed out
Accessibility
- The list is a role=status region named by label, so a source that recovers or fails later is announced. Each state is text; icons are aria-hidden.
- The failure NxAlert sits outside the status region (no nested live regions). Copy progress is a labelled progressbar plus the same count as text.
Do / Don’t
- Do: Show what did load next to which source did not.Don't render an empty state when a source failed; that is the anti-goal this component exists for.