<risk-register>
Composing preset that renders a sortable risk table + a likelihood × impact quadrant grid from one source.
Overview
The <risk-register> component renders both a sortable risk table and a likelihood × impact quadrant grid from a single data source. Severity is computed automatically (likelihood × impact) and color-coded with a low-good heatmap. Each risk appears as a labelled dot at its (likelihood, impact) coordinates in the quadrant view.
It composes <data-table> (sorting plus a data-heatmap="low-good" Severity column) and <quadrant-grid> — most of the code is glue, since both children do the work.
The component computes Severity itself and writes it into each Severity cell (as text and data-sort-value). It does not use <data-table>'s data-rollup="product", because that multiplies every numeric-looking cell in the row — a title such as “2FA rollout” or a mitigation such as “3 vendor quotes” would inflate the score. A row with a missing or non-numeric Likelihood or Impact gets an empty Severity cell and no dot in the grid.
Data source
Risks come from a <template> child. Each <tr> has cells in this order: Title, Likelihood (1–5), Impact (1–5), Owner, Mitigation. A data-id on the row provides a stable identifier.
<risk-register label="Q3 project risks"> <template> <tr data-id="vendor-delay"><td>Vendor delay</td><td>4</td><td>3</td><td>PM</td><td>Pre-stage assets in week 6</td></tr> <tr data-id="data-breach"><td>Data breach</td><td>2</td><td>5</td><td>Security</td><td>Tabletop exercise + WAF tuning</td></tr> </template></risk-register>
Or load asynchronously via src:
<risk-register src="/risks.json" label="Q3 project risks"></risk-register>
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
src | string | — | URL to JSON [{ id, title, likelihood, impact, owner, mitigation }] |
label | string | — | Optional heading shown above the layout |
Events
| Event | Detail | Description |
|---|---|---|
risk-register:ready | { count } | Fired after the table + grid render |
Quadrant placement
Scores are integers from 1 to 5 (larger values are capped at 5). Each score maps to a grid coordinate with (score − 1) / 4, so 1 sits on the low edge, 3 on the centre line, and 5 on the high edge. A score is in the high half only when it is above 3; a mid score of 3 counts as low. In the example above, “Vendor delay” (likelihood 4, impact 3) is high likelihood, low impact and lands in Mitigate; “Data breach” (2, 5) lands in Plan.
The grid uses standard risk-management labels:
- Avoid (Q1 — likelihood 4–5, impact 4–5)
- Plan (Q2 — likelihood 1–3, impact 4–5)
- Accept (Q3 — likelihood 1–3, impact 1–3)
- Mitigate (Q4 — likelihood 4–5, impact 1–3)
Layout
At narrow widths the table sits above the quadrant. At ≥ 64rem the layout switches to a 2-column side-by-side. Both views always reflect the same <template>.
Related
<data-table>— Provides the sorting and heatmap used here.<quadrant-grid>— Renders the labelled-dot view.