Loader
Provide a loading state for a component or page using a customizable loading spinner.
Variants
The loader component is available in a light
or dark
color, which you can choose using the variant
property.
<i-loader variant="light" />
<i-loader variant="dark" />
Sizes
You're able to use the size
modifier to control the size of your loader component, using one of the available sizes: sm
, md
, and lg
.
By default, loaders are set to have a 64px
width and height.
<i-loader size="sm" variant="dark" />
<i-loader size="md" variant="dark" />
<i-loader size="lg" variant="dark" />
You can set the loader size to fit the container that it is in by using the auto
size property. Make sure to use the same height and width to keep the correct aspect ratio.
<div style="height: 100px; width: 100px">
<i-loader size="auto" variant="dark" />
</div>
Slots
You're able to provide some additional text by using the default
loader slot.
<i-loader variant="dark">100%</i-loader>
Component API
Here you can find a list of the various customization options you can use for the loader component as props, as well as available slots.
Property count
Type Number
Default 12
Description Sets the number of elements that make up the loading spinner. To be used together with the $loader-item-count
Sass variable.
Property size
Type String
Accepted sm
, md
, lg
Default md
Description Sets the size of the loader component.
Property variant
Type String
Accepted light
, dark
Default light
Description Sets the color variant of the loader component.
Description Slot for loader default content.
Sass Variables
Here you can find a list of the Sass variables you can use for the loader components. If you're looking to find common variables that these rely on, you should take a look at the Sass Variables page.
Property $loader-size-base
Default 64px
Property $loader-size
Default size-map($loader-size-base, $sizes, $size-multipliers)
Property $loader-animation-duration
Default 1.2s
Property $loader-item-count
Default 12
Property $loader-item-size
Default 8%
Property $loader-variant-{variant}
Default loader-variant($color-{variant})
Property $loader-variants
Default (
light: $loader-variant-light,
dark: $loader-variant-dark
)
Default @function loader-variant($variant) {
$loader-variant-background: $variant;
$variant-map: (
background: $loader-variant-background,
);
@return $variant-map;
}