Loader
Toggle container that swaps between a loading spinner (OrigamProgress circular) and the default slot content. Carries aria-busy and aria-label when loading.
Preview
Rendering the live preview…
loadingRendering the live preview…
loadedStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-loader> — ① loading state (root with aria-busy, spinner rendered via #loader slot), ② loaded state (#default content visible), ③ OrigamProgress spinner (size=23, width=2, type=circular).- 1.origam-loader (loading)
- Root element while
loadingis truthy. Carriesaria-busy="true"andaria-label="Loading". Renders the#loaderslot. - 2.origam-loader (loaded)
- Root element while
loadingis falsy.aria-busyandaria-labelare absent. Renders the#defaultslot. - 3.origam-loader__progress
- OrigamProgress circular spinner injected in the default
#loaderslot.margin: autocentres it. Can be replaced by a custom slot.
API
Props
All props accepted by this component, with their type, default value and description.
- fullscreenboolean
- When truthy, hides the default slot and shows the #loader slot (or OrigamProgress by default). Sets aria-busy="true" and aria-label="Loading" on the root.
- loadingTextstring
- Override for the aria-label text shown while loading. Defaults to "Loading".
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- tagstring'span'
- Root HTML element tag.
- color
- Color passed to the OrigamProgress spinner shown in the loader slot.
API
Slots
Content slots exposed by this component.
- #loader
- Rendered when loading is truthy. Defaults to OrigamProgress (circular, size=23, width=2). Override to provide a custom spinner.
- #default
- Rendered when loading is falsy. This is the normal content.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to a child.
- Ref<string>
- Reactive CSS string generated by useStyle.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet. Called automatically on mount.
- () => void
- Removes the injected style sheet. Called automatically on unmount.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Height of the root element. Defaults to 100% to fill its parent.
- Position value when the fullscreen modifier class is applied.
- Height in fullscreen mode.
- Width in fullscreen mode.
- Margin around the progress spinner — auto centres it.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
Notes
- While loading, the root carries <code>aria-busy="true"</code> and <code>aria-label="Loading"</code> (or the custom loadingText). Screen readers announce the loading state.
- For critical async operations that change page content, consider wrapping OrigamLoader in a live region (<code>aria-live="polite"</code>) so the transition from loading to loaded is announced.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- other100%
- Default height of the loader root.
- otherauto
- Margin around the progress element in the loader slot.
- otherfixed
- Position in fullscreen mode.
- other100vh
- Height in fullscreen mode.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic usage
Custom spinner slot
Fullscreen loader