<capacity-plan>
Compact ledger that ties iron-triangle capacity, quality-target spend, and slotted work-item costs into a stacked-bar plan view.
Overview
The <capacity-plan> stitches the planning chain together visibly. It reads three numbers — capacity from a paired <iron-triangle>, quality spend from a paired <quality-target>, and feature spend from slotted elements with data-capacity-cost — and renders a four-row ledger with proportional bars: capacity vs quality vs features vs slack.
It's the answer to "where did my capacity go?" Without it, the chain is implicit; with it, the math is the first thing the team sees on the requirements page.
<iron-triangle id="shape"></iron-triangle><quality-target id="quality" data-bind-to="shape"></quality-target> <capacity-plan data-bind-triangle="shape" data-bind-quality="quality"> <work-item data-capacity-cost="3">Bulk import</work-item> <work-item data-capacity-cost="2">API webhooks</work-item></capacity-plan>
The arithmetic
Plain subtraction:
slack = capacityPoints − qualityCriticalSum − featureCostSum
Capacity comes only from the bound <iron-triangle>. When no triangle is bound, or its capacity is 0, capacity and slack show as ∞ and the quality and feature bars scale against each other instead of against a budget. A data-capacity-points fallback on the <quality-target> feeds that target's own budget, not this ledger.
With a finite budget, bars scale against the larger of capacity and total spend, so an overdrawn plan still fits the track. When slack goes negative its number turns red, the ledger gets an error-coloured outline (:state(overdrawn)), and capacity-plan:overdrawn fires. The event fires on every crossing of zero, in either direction, including the first render if the plan starts out overdrawn.
Two ways to supply feature spend
The component sums any descendant element with data-capacity-cost="N"; values that aren't positive numbers count as 0. Authors typically slot <work-item> children:
<iron-triangle id="shape"></iron-triangle><quality-target id="quality" data-bind-to="shape"></quality-target> <capacity-plan data-bind-triangle="shape" data-bind-quality="quality"> <work-item data-capacity-cost="3">Bulk import</work-item> <work-item data-capacity-cost="2">API webhooks</work-item></capacity-plan>
For server-rendered planning surfaces or programmatic flows, set featureSum directly; property override wins over slot inference. Set it to null (or anything that isn't a number) to go back to summing the children. Mutation observation re-renders automatically when children are added or removed or a child's data-capacity-cost changes.
Attributes
| Attribute | Values | Default | Description |
|---|---|---|---|
data-bind-triangle | string | — | ID of a sibling <iron-triangle> to read capacityPoints from |
data-bind-quality | string | — | ID of a sibling <quality-target> to read criticalSum from |
Properties & events
| Member | Description |
|---|---|
capacityPoints (R) | Live capacity from the bound triangle (or Infinity if absent). |
qualitySum (R) | Live critical sum from the bound quality target (or 0). |
featureSum (R/W) | Sum of data-capacity-cost across descendants, or an explicit number set by the host. A non-number clears the override. |
slack (R) | Computed: capacity − quality − features. |
capacity-plan:overdrawn (event) | Edge-triggered when slack crosses zero in either direction. detail is { ledger: { capacity, quality, features, slack }, source: 'render' }; read detail.ledger.slack < 0 to tell which way it crossed. |
States & styling hooks
| Hook | When |
|---|---|
:state(overdrawn) | Slack is below zero. Outlines the ledger in the error colour. |
[data-row="capacity|quality|features|slack"] | One ledger row each, for targeted styling. |
[data-row="slack"][data-state="over|under"] | Slack sign. over turns the slack number red and bold. |
Theme tokens
| Token | Default | Purpose |
|---|---|---|
--capacity-plan-max | 32rem | Max inline-size of the ledger container. |
| Bar colors | VB theme tokens: capacity --color-text (25% mix), quality --color-interactive, features --color-success, slack --color-text-muted (35% mix), overdrawn --color-error | Auto-adapt across light/dark and brand themes. There are no per-bar tokens; override the .bar-quality-style classes if you need different colours. |
Accessibility
The ledger is a <dl aria-label="Capacity ledger">: each row is a <dt> label with its value in a <dd>, so the capacity / quality / features / slack breakdown reads as text without relying on the bars, which carry no text. Bars adopt VB theme tokens so they auto-adapt across light, dark, and brand themes. The overdrawn state is conveyed by the signed slack value (e.g. "-3 pts"), not by colour alone. The ledger is not a live region: changes are not announced, so pair it with the bound components' own announcements, or add an aria-live wrapper if the ledger is the only feedback.
Related
<iron-triangle>— suppliescapacityPointsviadata-bind-triangle.<quality-target>— supplies the Critical-weight sum viadata-bind-quality.<work-item>— the slotted feature element whosedata-capacity-costthe plan sums.<requirement-card>— displays a single quality decision the plan accounts for.