Skip to main content
Version: latest
Works everywhere

Loading works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/loading) — the library detects the runtime automatically.

Loading

Loading renders a loading state indicator. It supports a full-screen overlay mode for page transitions and inline modes for lazy-loaded content regions.

Live demo →

Overview

import { Loading } from "@prokodo/ui/loading"

{
isFetching && <Loading variant="spinner" fullscreen />
}

Import

import { Loading } from "@prokodo/ui/loading"

Styling is handled via design tokens — no additional CSS import required.


Props

LoadingProps is a discriminated union between a plain spinner (variant="spinner", default) and a full-screen overlay (variant="overlay").

Common props

PropTypeDefaultRequiredDescription
variant"spinner" | "overlay""spinner"Visual style variant.
size"xs" | "sm" | "md" | "lg" | "xl""sm"Size of the spinner.
color"inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning" | "white"Explicit spinner color; defaults to currentColor if unset.
ariaLabelstring"Loading"Accessible label for screen readers.
reducedMotionbooleanDisable animation regardless of system preference.
classNamestringCSS class on root element.
styleCSSPropertiesInline styles on root element.

Additional overlay props (variant="overlay")

PropTypeDefaultDescription
showbooleantrueMount and show the overlay.
backdrop"light" | "dark" | "auto""auto"Backdrop color source (auto-detects system theme).
blurnumber0Backdrop blur intensity in px.
zIndexnumber9999z-index of the overlay container.

See src/components/loading/Loading.model.ts for the full LoadingProps type.


Design Tokens

Loading has no CSS custom-property tokens. The spinner color is driven entirely by the CSS color property.

MechanismDescription
color (prop)Maps to a design-system token (e.g. var(--pk-color-brand) for "primary").
currentColorWhen no color prop is set, the spinner inherits the parent element's CSS text color.

AIC Note

Use the standard import path in application code:

import { Loading } from "@prokodo/ui/loading"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.
4.1.3Status Messages (AA)✅ FulfilledStatus messages (loading, success, error, progress) must reach assistive technologies without a focus change (aria-live or role='status').

Test coverage: 2 jest-axe assertion(s) across 4 test file(s) · 1 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Loading in Storybook


Source

src/components/loading/Loading.model.ts