GitHub

Loading Overlay

Covers its positioned parent with a centered spinner and optional message while a region is busy. Opaque or semi-transparent backdrop.

Stable .astro import EsaLoadingOverlay from '@esa/ecology/esa-loading-overlay.astro';

Preview

Place the overlay inside a position: relative container; its absolute backdrop fills the parent.

Underlying content that is being covered while loading.

Loading data…

<div style="position: relative; min-height: 180px;">
  <p>Underlying content being covered.</p>
  <LoadingOverlay active={true} message="Loading data…" />
</div>

States

A transparent backdrop lets the content show through faintly. When active is false the overlay renders nothing.

You can still see this content faintly through the overlay.

Saving…

Inactive — the overlay renders nothing.

<LoadingOverlay active={true} transparent={true} message="Saving…" />
<LoadingOverlay active={false} />

API

PropTypeDefaultDescription
active boolean false When false the overlay renders nothing.
message string Optional caption shown under the spinner.
transparent boolean false Semi-transparent backdrop instead of an opaque one.

Accessibility

  • The spinner carries role="status" and aria-label="Loading".
  • The backdrop sits at z-index: 10 over the parent and intercepts interaction while active.
  • For long operations, consider moving focus or announcing the busy state at the call site.

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
--loading-overlay-bg component #fcfcfc via --color-surface--color-gray-1
--loading-overlay-bg-transparent component rgba(255, 255, 255, 0.8)
--loading-overlay-message-color component #646464 via --color-text-secondary--color-gray-11
--loading-spinner-color component #46a758 via --color-primary--color-grass-9
--loading-spinner-track-color component #d9d9d9 via --color-border-light--color-gray-6
--type-size-150 semantic clamp(0.6875rem, 0.61rem + 0.38vw, 0.875rem)
--radius-full primitive 9999px
--spacing-300 primitive 0.75rem