PageLoading
A full-page loading state: a full-screen mask with three built-in modes — spinner (default), skeleton rows, and progress.
- The
openattribute controls visibility (controlled);show()/close()offer programmatic control modeswitches the presentation;textoverrides the loading copy (default i18nloading.loading)skeletonusesrows;progressusesvalue(0–100)role="status"+aria-live="polite"; the progress track keepsaria-valuenowin sync- Under
prefers-reduced-motionthe spin and skeleton pulse animations are disabled
Basic Usage
Three modes (each closes itself after 2s)
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-closeRemoving the open attribute from the host is silent (no event); only close() dispatches oas-close with detail { mode }.
API
oas-page-loading
Attributes
| Attribute | Description | Type | Default |
|---|---|---|---|
mode | Presentation: spinner (default) / skeleton / progress; invalid falls back to spinner | string | — |
open | Controlled visibility (present = full-screen mask). Removing it from the host is silent | — | — |
rows | Skeleton row count (skeleton mode only): positive integer, default 4, clamped to 1–12 | string | — |
text | Copy override; defaults to i18n loading.loading | string | — |
value | Progress percentage (progress mode only): 0–100, clamped; invalid falls back to 0 | string | — |
Methods
| Method | Signature | Description |
|---|---|---|
show | show(): void | Show the loading state (same as writing the open attribute) |
close | close(): void | Close: removes open and dispatches oas-close |
Events
| Event | Description |
|---|---|
oas-close | Dispatched when closed via close(), detail: { mode: this.resolveMode() } |
CSS Variables
| CSS Variable | Description | Default |
|---|---|---|
--oas-page-loading-bar | Progress bar color | var(--oas-color-primary) |
--oas-page-loading-bg | Panel background | var(--oas-color-bg) |
--oas-page-loading-blur | Mask backdrop blur | none |
--oas-page-loading-color | Panel text color | var(--oas-color-text-primary) |
--oas-page-loading-mask | Full-screen mask color | var(--oas-color-overlay) |
--oas-page-loading-max-width | Panel max width | 360px |
--oas-page-loading-pulse-duration | Skeleton pulse period | 1.4s |
--oas-page-loading-shadow | Panel shadow | 0 8px 32px color-mix(in srgb, var(--oas-color-overlay) 28%, transparent) |
--oas-page-loading-skeleton | Skeleton row color | color-mix(in srgb, var(--oas-color-text-primary) 10%, transparent) |
--oas-page-loading-spin-duration | Spinner rotation period | 0.9s |
--oas-page-loading-spinner-color | Spinner color | var(--oas-color-primary) |
--oas-page-loading-spinner-size | Spinner size | 32px |
--oas-page-loading-track | Progress track color | color-mix(in srgb, var(--oas-color-text-primary) 12%, transparent) |