Components
Skeleton
A placeholder preview of content while data loads.
Installation
$ npx veil-ui@latest add skeletonUsage
import { Skeleton } from "@/components/ui/skeleton";
<Skeleton className="h-4 w-32" />;Examples
Basic
Card
List
API reference
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | Set the width, height and radius of the placeholder. |
| ...props | React.ComponentProps<"div"> | — | All native div attributes. |
Accessibility
- Skeletons are
aria-hidden; they should never be announced. - Mark the surrounding region with
aria-busy="true"while loading, and keep the skeleton layout close to the final content to avoid layout shifts. - Respect
prefers-reduced-motion: the pulse animation is defined in the component and pauses when reduced motion is requested.
Vue and plain HTML
This component also ships for Vue (Reka UI) and plain HTML. Install it with npx veil-ui add skeleton --framework vue or switch the framework in components.json.
<script setup lang="ts">
import { cn } from "@/lib/utils";
const props = defineProps<{ class?: string }>();
</script>
<template>
<div
data-slot="skeleton"
aria-hidden="true"
:class="cn('animate-pulse rounded-md bg-muted', props.class)"
/>
</template>