Skip to content

PageLoading ​

A full-page loading state: a full-screen mask with three built-in modes — spinner (default), skeleton rows, and progress.

  • The open attribute controls visibility (controlled); show() / close() offer programmatic control
  • mode switches the presentation; text overrides the loading copy (default i18n loading.loading)
  • skeleton uses rows; progress uses value (0–100)
  • role="status" + aria-live="polite"; the progress track keeps aria-valuenow in sync
  • Under prefers-reduced-motion the spin and skeleton pulse animations are disabled

Basic Usage ​

Three modes (each closes itself after 2s)

SpinnerSkeletonProgress

Not closed yet

Skeleton Mode ​

skeleton generates rows from rows, with the last row shortened (1–12 rows, clamped):

Skeleton rows (invisible while not open)

This instance has no open attribute — click "Skeleton" above to see the full-screen effect.

Progress Mode ​

value is a 0–100 percentage; out-of-range values clamp, invalid values fall back to 0, and aria-valuenow follows the width.

Progress demo (script drives it to 100% then closes)

Click "Progress" above to watch the automatic advance.

Programmatic Control ​

js
const loading = document.querySelector('oas-page-loading')
loading.show() // same as writing the open attribute
loading.close() // removes open and dispatches oas-close

Removing the open attribute from the host is silent (no event); only close() dispatches oas-close with detail { mode }.

API ​

oas-page-loading ​

Attributes ​

AttributeDescriptionTypeDefault
modePresentation: spinner (default) / skeleton / progress; invalid falls back to spinnerstring—
openControlled visibility (present = full-screen mask). Removing it from the host is silent——
rowsSkeleton row count (skeleton mode only): positive integer, default 4, clamped to 1–12string—
textCopy override; defaults to i18n loading.loadingstring—
valueProgress percentage (progress mode only): 0–100, clamped; invalid falls back to 0string—

Methods ​

MethodSignatureDescription
showshow(): voidShow the loading state (same as writing the open attribute)
closeclose(): voidClose: removes open and dispatches oas-close

Events ​

EventDescription
oas-closeDispatched when closed via close(), detail: { mode: this.resolveMode() }

CSS Variables ​

CSS VariableDescriptionDefault
--oas-page-loading-barProgress bar colorvar(--oas-color-primary)
--oas-page-loading-bgPanel backgroundvar(--oas-color-bg)
--oas-page-loading-blurMask backdrop blurnone
--oas-page-loading-colorPanel text colorvar(--oas-color-text-primary)
--oas-page-loading-maskFull-screen mask colorvar(--oas-color-overlay)
--oas-page-loading-max-widthPanel max width360px
--oas-page-loading-pulse-durationSkeleton pulse period1.4s
--oas-page-loading-shadowPanel shadow0 8px 32px color-mix(in srgb, var(--oas-color-overlay) 28%, transparent)
--oas-page-loading-skeletonSkeleton row colorcolor-mix(in srgb, var(--oas-color-text-primary) 10%, transparent)
--oas-page-loading-spin-durationSpinner rotation period0.9s
--oas-page-loading-spinner-colorSpinner colorvar(--oas-color-primary)
--oas-page-loading-spinner-sizeSpinner size32px
--oas-page-loading-trackProgress track colorcolor-mix(in srgb, var(--oas-color-text-primary) 12%, transparent)

Released under the MIT OR Apache-2.0 License.