← API Index · How to use components
loading component .oo-loading
Use this component to indicate loading and, if designed so, to block user input while a
longer process is running. It is controlled by the toolkit's network layer: whenever requests
are in flight the component is shown, once all are done it is hidden. It is addressed by the
class oo-loading; several per page are possible.
Inside (or anywhere on the page) these elements are toggled:
| Element | Description |
|---|---|
.oo-loading |
The component itself — shown as soon as any loading is active. Make it a small, unobtrusive, animated element. |
.oo-loading-small |
Shown together with the component; may be placed anywhere on the page. |
.oo-loading-long (or .oo-loading-big) |
Shown in addition if loading takes longer than oo-loading-long milliseconds — e.g. a full screen overlay that blocks input. |
.oo-loading-init |
A start-up element (e.g. "loading shop…") hidden once the first loading cycle completes; while present, the long indicator is not shown. |
img inside the component |
Gets the server provided loading animation assigned. |
See also the loadingbar (a thin progress bar) and the progressbar (byte progress of large downloads) components.
How components are mounted, how switch values are resolved and how debug output is enabled is described in the use-js-components skill.
<div class="oo-loading" data-oo-loading-long="1500">
<span class="oo-loading-small"><img src=""/></span>
<div class="oo-loading-long oo-hidden">Sorry, loading takes time…</div>
</div>
component switches
| Switch | Default | Description |
|---|---|---|
oo-loading-long |
1500 |
Milliseconds until the .oo-loading-long elements are shown in addition to the small indicator. Set it on the element. |
debug options
Debug scope loader (enable with data-oo-debug="true" on the element or debug:loader:all+, see the skill):
| Term | Description |
|---|---|
loader:all |
On / off signals from the network layer and which indicator elements are toggled. |