WlSkeleton
Skeleton while content loads.
Components / Data v0.1.0
Appearance
preset
text
shape
rectangle
lines
Full example
<div class="wl-stack" data-space="md">
<div
role="status"
aria-label="Loading materials"
aria-busy="true"
class="wl-stack"
data-space="sm"
>
<WlSkeleton preset="avatar" />
<WlSkeleton preset="text" :lines="3" />
</div>
</div>Size and density
width
height
borderRadius
Full example
<div class="wl-stack" data-space="md">
<div
role="status"
aria-label="Loading materials"
aria-busy="true"
class="wl-stack"
data-space="sm"
>
<WlSkeleton preset="avatar" />
<WlSkeleton preset="text" :lines="3" />
</div>
</div>Card while loading
Rectangle/circle, sizes and radius, aria-busy with an explanation and transition to real content.
Loading member card…
Full example
<script setup lang="ts">
import { WlAvatar, WlButton, WlSkeleton } from "legato-ui";
import { ref } from "vue";
const loading = ref(true);
</script>
<template>
<div class="wl-stack" data-space="lg">
<div>
<WlButton size="sm" @click="loading = !loading">
{{ loading ? "Show loaded card" : "Reload card" }}
</WlButton>
</div>
<article
class="wl-surface wl-stack"
data-space="lg"
:aria-busy="loading"
aria-label="Member card"
>
<div v-if="loading" class="wl-stack" data-space="md">
<div class="wl-inline" data-space="md">
<WlSkeleton shape="circle" width="40px" height="40px" />
<div class="showcase-skeleton-lines wl-stack" data-space="sm">
<WlSkeleton height="14px" width="70%" /><WlSkeleton height="11px" width="45%" />
</div>
</div>
<WlSkeleton height="12px" /><WlSkeleton height="12px" width="80%" /><WlSkeleton height="48px" border-radius="8px" />
</div>
<div v-else class="wl-stack" data-space="md">
<div class="wl-inline" data-space="md">
<WlAvatar label="DG" :size="36" />
<h3 class="wl-text-subheading">{{ "Dmitry" }}</h3>
</div>
<p class="wl-text-body">{{ "Materials are ready for review. Rectangle and circle showed the element shapes while loading." }}</p>
</div>
</article>
<p class="wl-text-small" role="status">
{{ loading ? "Loading member card…" : "Member card loaded." }}
</p>
</div>
</template>
<style scoped>
.showcase-skeleton-lines { flex: 1; min-width: 0; }
</style>Props
Types, accepted values and literal defaults come from the public manifest. Inherited settings name their source; “Not set” means no default is declared.
| Prop | Type / values | Default | Purpose |
|---|---|---|---|
width | string | "100%" | Width (CSS). |
height | string | "12px" | Height (CSS). |
borderRadius | string | Not set | Radius (CSS). |
shape | "rectangle" | | "rectangle" | Shape. |
pt | WlPt< | Not set | Attributes of internal Legato UI elements. |
preset | "text" | | Not set | Apply the text or avatar skeleton presentation. |
lines | number | 1 | Number of placeholder lines in the text preset. |
Events
No public events.
Slots
No public slots.
Pass-through: pt
Sections WlSkeleton are listed below. Attributes merge in this order: createWlPt() WlConfig.ptpt instance. Class and style merge; the last supplied value takes priority for other attributes.
| Section | DOM | Purpose |
|---|---|---|
root | span | The root section in WlConfig.pt.skeleton configuration. |
line | span.wl-skeleton | One rendered skeleton line. |
Sections refer to the component DOM. Dotted names identify a configuration group and its section; composite parts use their own pt groups. Global and local attributes merge, with class and style added together.
Keyboard and accessibility
- Skeletons are hidden with aria-hidden and must remain outside the focus order.
- Set aria-busy on the containing block and describe what is loading in text.
- After loading, replace the placeholder with content. On failure, show a message and retry button.
Keyboard and application responsibilities
Provide a meaningful accessible name and connect labels, hints and errors to the focusable element. Check the behavior with your own data and a screen reader.
WAI-ARIA Authoring PracticesIn your application, check keyboard controls, zoom and focus visibility. State labels and required information must be readable in every theme.