Guide
Real Screens
How it looks on the pages you actually build.
Every example here makes a real request to DummyJSON. Press Reload to see the loading state again.
A product card
Click the card to load another product. Descriptions differ in length, so a new product eases to its own height, and one you've already seen comes back at the right size. The photo opens full size with nuxt-image-viewer.
GET /products/24loadingLoading product
Click the card to load another product.
<script setup lang="ts">
const id = ref(11)
const product = useFetch<Product>(() => `/api/products/${id.value}`, { lazy: true, server: false })
const sample: Product = { title: 'A product name', description: 'A description of typical length.', thumbnail: '' }
</script>
<template>
<Skeleton :id="`product-${id}`" :of="product" :sample reveal="sequence">
<template #default="{ data }">
<img :src="data.thumbnail" width="300" height="300" alt="">
<h3>{{ data.title }}</h3>
<p>{{ data.description }}</p>
</template>
</Skeleton>
</template>
A profile with two requests
Each request gets its own <Skeleton>, so the header appears as soon as it's ready and the posts follow.
GET /users/1 + /postsloadingLoading profile
Loading posts
<template>
<Skeleton :of="user" :sample="sampleUser">
<template #default="{ data }">
<UAvatar :src="data.image" size="2xl" />
<h3>{{ data.firstName }} {{ data.lastName }}</h3>
</template>
</Skeleton>
<Skeleton :of="posts" :sample="samplePosts">
<template #default="{ data }">
<article v-for="post in data.posts" :key="post.id">
<h4>{{ post.title }}</h4>
<p class="line-clamp-2">{{ post.body }}</p>
</article>
</template>
<template #empty>No posts yet.</template>
</Skeleton>
</template>
An admin dashboard
One request fills the stats and the table. Table cells become bars, so the rows don't merge into one gray block.
GET /carts + /usersloadingLoading orders
<template>
<Skeleton :of="orders" :sample>
<template #default="{ data }">
<dl class="grid grid-cols-3 gap-3">
<div v-for="stat in stats(data)" :key="stat.label">
<dt>{{ stat.label }}</dt>
<dd>{{ stat.value }}</dd>
</div>
</dl>
<UTable :data="data.carts" :columns />
</template>
</Skeleton>
</template>
An inbox
Avatars take the shape of their round frame, and truncated text gets a bar no wider than the line.
GET /commentsloadingLoading messages
<template>
<Skeleton :of="inbox" :sample>
<template #default="{ data }">
<ul>
<li v-for="message in data.comments" :key="message.id" class="flex items-center gap-3">
<UAvatar :src="message.avatar" />
<p class="truncate">{{ message.body }}</p>
<UBadge :label="message.likes" />
</li>
</ul>
</template>
<template #empty>No messages yet.</template>
</Skeleton>
</template>