WlSkeleton
Skeleton while content loads.
Change props to see the result: the example and code use the same settings. “Reset” restores the initial values.
Settings
shape
rectangle
Shape.
width
Width (CSS).
height
Height (CSS).
borderRadius
Radius (CSS).
lines
Number of placeholder lines in the text preset.
Props pt, preset, models, handlers and slots can be edited in the SFC. See their descriptions in API.
Example
Focus: outside the example · pointer: outside the example
Explore the live example and copy its Vue SFC into your application. Settings on the left can be combined.
Code for your application
Vue SFC · current settings
<script setup lang="ts">
import { WlSkeleton } from "legato-ui";
</script>
<template>
<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>
</template>Card while loading
Rectangle/circle, sizes and radius, aria-busy with an explanation and transition to real content.
Loading member card…
Vue SFC · additional 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>