4.2.0
Patterns

ApprovalCard

The gate in front of an action that costs money or cannot be taken back — what it does, what it costs, who may approve it, and what becomes permanent.

Default

Every part is optional and this is the full shape: what the action does, what it costs, who may approve it, what becomes permanent, and the choice. The figures line up on the card's right edge in tabular figures, and the total is ruled off in full ink — the one number the reader is committing to.

Promote build 4821 to production

Six services restart in eu-west-1 as soon as this is approved.

Compute, first month
€48.00
Egress, estimated
€6.40
Build minutes
€1.20
Charged today
€55.60
Owneror any admin

The running build is discarded on promotion and cannot be restored from here.

Usage

import {
  ApprovalCard,
  ApprovalCardActions,
  ApprovalCardAuthority,
  ApprovalCardConsequence,
  ApprovalCardCost,
  ApprovalCardCosts,
  ApprovalCardHeader,
  ApprovalCardSummary,
  ApprovalCardTitle,
  ApprovalCardTotal,
} from '@oceanic-hub/brand-system'
<ApprovalCard>
  <ApprovalCardHeader>
    <ApprovalCardTitle>…</ApprovalCardTitle>
    <ApprovalCardSummary>…</ApprovalCardSummary>
  </ApprovalCardHeader>
  <ApprovalCardCosts>
    <ApprovalCardCost amount={…} label={…}>…</ApprovalCardCost>
    <ApprovalCardTotal amount={…} label={…}>…</ApprovalCardTotal>
  </ApprovalCardCosts>
  <ApprovalCardAuthority>…</ApprovalCardAuthority>
  <ApprovalCardConsequence>…</ApprovalCardConsequence>
  <ApprovalCardActions>…</ApprovalCardActions>
</ApprovalCard>

Composition

Use the following composition to build an ApprovalCard:

ApprovalCard
├── ApprovalCardHeader
│   ├── ApprovalCardTitle
│   └── ApprovalCardSummary
├── ApprovalCardCosts
│   ├── ApprovalCardCost ×3
│   └── ApprovalCardTotal
├── ApprovalCardAuthority
├── ApprovalCardConsequence
└── ApprovalCardActions

Compositional, like Item and Empty, and for the same reason: a costed confirmation is a small document — heading, figures, attribution, a sentence, a choice — and every one of those parts is somebody's node. A costs={[…]} array would be shorter to type and would decide, for every caller forever, that a cost label cannot carry a tooltip trigger.

The package authors none of the words. No "Approve", no "Cancel", no "Total", no currency symbol, no "this action is permanent". ApprovalCardTotal takes its own label for the same reason as every other part: the word for the bottom line differs by surface and by language, and a package-supplied one is wrong in a way nobody notices until it is read aloud. Amounts arrive already formatted — the component lines them up in tabular figures and never parses or sums them, so no figure on the card is one this package derived.

It paints no status colour. KPIStat's doctrine one component over: status tone lives in pills, dots and meters, and a costed confirmation is none of the three. A caller who needs the card to read as dangerous says so with what they put in it — a destructive Button, a StatusPill in the authority row — because "irreversible" and "expensive" are different warnings and this card serves both. Elevation is the hairline-strong border, so the card reads as consequential without a shadow and without a hue.

ApprovalCardAuthority is a SLOT and not a prop. The package does not know autonomy levels by name and must not learn them: an authority="owner" axis would put one product's permission model into every other product's semver.

readOnly is for a reader whose role may not approve. The actions are not rendered at all — not hidden with a class, not disabled — so no control exists for a keyboard or a screen reader to reach and announce as refused, and reason is required by the type whenever readOnly is set. That pairing is the enforceable half of the rule: hiding the buttons and saying nothing is the disabled button with its tooltip taken away, and only the type system was going to stop it. The state travels by context, so ApprovalCardActions can sit at any depth a caller composes it at.

Reach for AlertDialog instead when the decision must interrupt — it is modal, it traps focus, and it carries a sentence and two verbs but no figures. Reach for Alert when there is news but no choice. This card is the in-page case: the reader is meant to read the numbers before deciding, which is exactly what a modal is bad at.

When the reader may not approve

readOnly removes the actions rather than disabling them — there is no control left for a keyboard or a screen reader to reach and announce as unavailable. reason is then required by the type, because hiding the buttons and saying nothing is the disabled button with its tooltip taken away. The figures stay: a reader who cannot approve still has to be able to check what is being asked for.

Promote build 4821 to production

Six services restart in eu-west-1 as soon as this is approved.

Compute, first month
€48.00
Egress, estimated
€6.40
Build minutes
€1.20
Charged today
€55.60
Owner

The running build is discarded on promotion and cannot be restored from here.

You can see this request but not approve it — spend above €50 needs an owner.

Irreversible, and free

Not every gate is a spend. With no ApprovalCardCosts the card is a consequence and a choice — which is the case the four surfaces that prompted this component were each about to hand-roll separately from the costed one, out of the same Card and the same Alert.

Delete the staging environment

Two services and their build history go with it.

Owner

Deleted environments are not recoverable and the name is released for reuse.

API Reference

See the ApprovalCard API page for every prop of every part, with types, defaults and the contract that pins them.

On this page