Skip to content

loader

The loader macro is used to render a spinner indicating that something is loading.

Definition

{% loader(options) %}

Input parameters

options

object represents an object of loader options and attributes

Option key Type Default Required Description
options.ariaLabel string "" no aria-label attribute of the loader

Example

In this example we render a basic loader

{% from "@macros/loader.twig" import loader %}

{{ loader() }}

Example

In this example we render a loader with a custom aria label

{% from "@macros/loader.twig" import loader %}

{{ loader({ ariaLabel: 'loader for a list of products' }) }}

Macro source code

{% macro loader(options) %}
    <div {% if options.ariaLabel %}aria-label="{{ options.ariaLabel }}"{% endif %} class="loader loader_full">
        <div class="loader__spinner"></div>
    </div>
{% endmacro %}