Loader
Toggle container that swaps between a loading spinner (OrigamProgress circular) and the default slot content. Carries aria-busy and aria-label when loading.
Aperçu
Rendu de l’aperçu en cours…
loadingRendu de l’aperçu en cours…
loadedStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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
Emplacements de contenu exposés par ce composant.
- #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
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <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.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- 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
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
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.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- 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.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Basic usage
Custom spinner slot
Fullscreen loader