Loader
Used for the loading status of a page or a block.
When To Use
- When part of the page is waiting for asynchronous data or during a rendering process, an appropriate loading animation can effectively alleviate users' inquietude.
Basic Usage
A simple loading status.
Loading...
astro
---
import Loader from '@/components/feedback/Loader.astro';
---
<Loader /> Variants
Different visual styles for the loading indicator.
Loading...
Spinner
Loading...
Dots Progress
astro
---
import Loader from '@/components/feedback/Loader.astro';
---
<div class="flex flex-col items-center gap-4 w-32">
<Loader variant="spinner" />
<span class="text-sm text-zinc-500">Spinner</span>
</div>
<div class="flex flex-col items-center gap-4 w-32">
<Loader variant="dots" />
<span class="text-sm text-zinc-500">Dots</span>
</div>
<div class="flex flex-col items-center gap-4 w-64">
<Loader variant="progress" />
<span class="text-sm text-zinc-500">Progress</span>
</div> Sizes
A small loader is used in text, default loader in card-level blocks, and large loader in pages.
Loading...
Loading...
Loading...
Loading...
astro
---
import Loader from '@/components/feedback/Loader.astro';
---
<Loader size="sm" />
<Loader size="md" />
<Loader size="lg" />
<Loader size="xl" /> With Custom Content
Customized description content and icons.
Saving changes...
Loading...
Uploading fileThis might take a few moments
Loading...
astro
---
import Loader from '@/components/feedback/Loader.astro';
import Icon from '@/components/general/Icon.astro';
---
<Loader variant="spinner" label="Saving changes..." />
<Loader variant="dots" size="lg">
<Icon name="CloudUpload" slot="icon" class="h-8 w-8 text-blue-500" />
<span slot="label">Uploading file</span>
<span slot="description">This might take a few moments</span>
</Loader> API Reference
| Property | Description | Type | Default |
|---|---|---|---|
| variant | The visual style of the loader (spinner, dots, progress). | 'spinner' | 'dots' | 'progress' | 'spinner' |
| size | The size of the loader (sm, md, lg, xl). | 'sm' | 'md' | 'lg' | 'xl' | 'md' |
| label | Primary text displayed below the loader. | string | - |
| description | Secondary text displayed below the label. | string | - |
| active | Whether the loader is visible. | boolean | true |
| animation | Whether the loader is animating. | boolean | true |