useLoader
Commons
stable
Resolves the polymorphic loading prop (boolean | number | TLoaderConfig) into a normalised descriptor used by the consuming component to mount the correct progress renderer (line, circular, or skeleton) with the correct props. Emits a BEM loading class while active.
API
Signature
Full TypeScript signature sourced from the composable file.
Consumed interfaces
ILoaderProps
IResolvedLoader
API
Parameters
Input parameters accepted by this composable.
- propsrequiredILoaderProps
- Component props extending ILoaderProps. The loading key accepts boolean (indeterminate), number (determinate 0-100), or a TLoaderConfig object with an explicit type discriminant.
- defaultKindTLoaderKindLOADER_KIND.CIRCULAR
- Renderer to use when loading is true or a plain number (no explicit type). Common values: 'circular' (Btn default), 'line' (Card default), 'skeleton'.
- namestringgetCurrentInstanceName()
- Kebab-case component name used to build the ${name}--loading BEM modifier class. Defaults to the current component name via getCurrentInstanceName().
API
Return values
Properties and methods exposed by the composable return object.
- isLoading
- True when the loading prop is truthy (boolean true, a number, or a TLoaderConfig object).
- loaderClasses
- Class map to bind via :class. Contains { "${name}--loading": true } when isLoading is true.
- loaderConfig
- Normalised descriptor: isActive, kind (renderer type), modelValue (determinate progress), indeterminate flag, and overrides (per-kind props to v-bind on the renderer). Use this to conditionally mount OrigamProgress or OrigamSkeleton.
Usage
Examples
Ready-to-paste usage snippets.
Indeterminate circular loader
Determinate line loader