Skeleton
A pulsing placeholder that holds the shape of loading content.
import { Skeleton } from '@elluzion/iv-ui'; 01 Preview
Shapes
Rectangle, text line, and circle placeholders.
Source· svelte Show Hide
<script lang="ts">
import { Skeleton } from '@elluzion/iv-ui';
</script>
<div class="stack">
<Skeleton shape="rect" height={72} />
<Skeleton shape="line" />
<Skeleton shape="line" width="70%" />
<Skeleton shape="circle" />
</div>
<style>
.stack {
display: flex;
flex-direction: column;
gap: var(--iv_spacing-md);
width: 100%;
max-width: 320px;
}
</style>02 Usage
shapepicks rect, line, or circle;widthandheightaccept numbers or CSS lengths.- Match the dimensions of the content that replaces it to avoid layout shift.
- Combine several skeletons to sketch a list or card while data loads.
03 Examples
Card placeholder
A composition that mirrors the final card layout.
Source· svelte Show Hide
<script lang="ts">
import { Card, Skeleton } from '@elluzion/iv-ui';
</script>
<Card padding="lg">
<div class="head">
<Skeleton shape="circle" width={32} height={32} />
<div class="meta">
<Skeleton shape="line" width="45%" />
<Skeleton shape="line" width="30%" />
</div>
</div>
<Skeleton shape="line" />
<Skeleton shape="line" width="85%" />
<Skeleton shape="line" width="60%" />
</Card>
<style>
.head {
display: flex;
align-items: center;
gap: var(--iv_spacing-md);
margin-bottom: var(--iv_spacing-lg);
}
.meta {
display: flex;
flex: 1;
flex-direction: column;
gap: var(--iv_spacing-xs);
}
</style>04 API
import { Skeleton } from '@elluzion/iv-ui';Props
4 props · 0 events · 0 snippets| Prop | Type | Default | Description |
|---|---|---|---|
| shape | 'rect' | 'line' | 'circle' | 'rect' | Visual shape of the placeholder. |
| width | string | number | — | Width; numbers are treated as pixels. |
| height | string | number | — | Height; numbers are treated as pixels. |
| className | string | '' | Extra classes merged onto the root element. |
05 Accessibility
- Skeletons are hidden from assistive technology.
- The pulse stops when
prefers-reduced-motionis set. - Announce loading elsewhere, for example with
role="status"or anAlert.
06 Tokens & CSS hooks
Class hooks
.iv-circle.iv-line.iv-rect.iv-skeleton