GitHub

Danger Zone

A bordered section that corrals one or more destructive actions behind clear danger-colored chrome — a tinted background, danger border, and danger-colored heading — so a misclick is harder to make by accident.

Stable .astro import EsaDangerZone from '@esa/ecology/esa-danger-zone.astro';

Preview

Danger Zone

Deleting this project also removes its annotations and history. This cannot be undone.

<EsaDangerZone description="Deleting this project also removes its annotations and history. This cannot be undone.">
  <EsaButton color="danger">Delete project</EsaButton>
</EsaDangerZone>

Multiple actions

Project any number of destructive actions into the default slot — they wrap on a shared gap.

Irreversible actions

These operations cannot be undone.

<EsaDangerZone heading="Irreversible actions" description="These operations cannot be undone.">
  <EsaButton color="danger" appearance="outline">Archive</EsaButton>
  <EsaButton color="danger">Delete</EsaButton>
</EsaDangerZone>

Heading only

The description is optional — omit it for a compact zone.

Danger Zone

<EsaDangerZone>
  <EsaButton color="danger">Revoke access</EsaButton>
</EsaDangerZone>

API

PropTypeDefaultDescription
heading string 'Danger Zone' Section heading, rendered in danger color and wired to the group via aria-labelledby.
description string Optional supporting copy explaining the consequence of the actions.

The default slot holds the destructive action(s) or content — typically one or more esa-button elements with color="danger".

Accessibility

  • Renders a <section role="group"> labelled by its heading via aria-labelledby, so assistive tech announces the grouping and its name.
  • The heading is a real <h3> — keep the document outline in mind and override the level in your own markup if the surrounding context needs it.
  • Danger emphasis is conveyed by a tinted background, full border, and heading color — never by color alone for meaning; the heading text itself names the intent.
  • Pair each destructive action with a confirmation step (e.g. a confirm dialog) so the zone is the warning and the dialog is the gate.

Theming surface

Every public token this component reads, extracted from its source at build time. The Resolves to column walks each token's real lineage — component → semantic → primitive → raw value — so you can see exactly where re-pointing it lands. A spoke re-skins by overriding these in its theme-<slug>.css; component internals are never edited. No hook for what you need? File it with /request-lego.

TokenTierResolves to
--danger-zone-bg component #fff7f7 via --color-danger-subtle--color-red-2
--danger-zone-border-color component #fdbdbe via --color-danger-border--color-red-6
--danger-zone-description-color component #646464 via --color-text-secondary--color-gray-11
--danger-zone-heading-color component #ce2c31 via --color-red-11
--danger-zone-padding component 0.75rem via --spacing-300
--danger-zone-radius component 0.5rem via --radius-200
--font-sans semantic 'DM Sans', sans-serif
--type-size-200 semantic clamp(0.75rem, 0.66rem + 0.44vw, 0.9375rem)
--type-size-250 semantic clamp(0.8125rem, 0.71rem + 0.5vw, 1.0625rem)
--spacing-200 primitive 0.5rem