Loader

Feedback & Status
stable

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…

loading

Rendering the live preview…

loaded

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamLoaderSchematic of the Loader component in its two states: loading and loaded. loading=true → #loader slot #default slot content loading=false 1 2 3
Anatomy of <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 loading is truthy. Carries aria-busy="true" and aria-label="Loading". Renders the #loader slot.
2.origam-loader (loaded)
Root element while loading is falsy. aria-busy and aria-label are absent. Renders the #default slot.
3.origam-loader__progress
OrigamProgress circular spinner injected in the default #loader slot. margin: auto centres it. Can be replaced by a custom slot.

API

Props

All props accepted by this component, with their type, default value and description.

fullscreen
boolean
loading
false
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.
loadingText
string
Override for the aria-label text shown while loading. Defaults to "Loading".
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
tag
string
'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.

Source
other
100%
Default height of the loader root.
other
auto
Margin around the progress element in the loader slot.
other
fixed
Position in fullscreen mode.
other
100vh
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

vue

Custom spinner slot

vue

Fullscreen loader

vue