Examples
Text, avatar, and media placeholders
Match the placeholder geometry to the content that will appear. Skeleton is decorative and must not stand in for an error or empty message.
Text, circular avatar, and rectangle placeholders
import { Skeleton } from "@phuctech/ui/components/skeleton";
export function Example() {
return (
<div className="grid w-full max-w-xl gap-5">
<div className="flex items-start gap-3">
<Skeleton shape="circle" />
<div className="grid min-w-0 flex-1 gap-2">
<Skeleton className="w-2/5" />
<Skeleton lines={3} />
</div>
</div>
<Skeleton shape="rectangle" />
</div>
);
}
Try the props
Choose one supported placeholder shape and a text line count.
Skeleton property playground
import { Skeleton } from "@phuctech/ui/components/skeleton";
export function Example() {
return (
<div className="w-full max-w-xl">
<Skeleton shape="text" lines={3} />
</div>
);
}When to use
Use Skeleton for the initial wait when the shape of the eventual content is known. Keep the placeholder layout close to the content it replaces. Use Spinner for a local operation and EmptyState when the request has completed but there is nothing to show.
Usage
import { Skeleton } from "@phuctech/ui/components/skeleton";
<Skeleton shape="text" lines={3} />Skeleton is decorative, uses aria-hidden, and does not communicate loading completion or errors.
API
Tokens
Accessibility
- Skeletons are hidden from assistive technology so repeated placeholder blocks are not announced as content.
- Keep a separate status or heading when users need to know what is loading.
Do and don’t
Match the count and rough size of the content that will replace the placeholder.
Use a skeleton to represent an error, an empty result, or indefinite background work.
Related
- Spinner communicates work in progress.
- EmptyState communicates that no content is available.