- Docs
- Components
- Feedback
Skeleton
A placeholder shaped like the content that's loading, so the page doesn't move when it lands.
- Import
- @qeetrix/react
- Status
- StableSince 0.0.2
- Renders
<span aria-hidden="true">Server-rendered- Tested
- WCAG 2.2 AAaxe on every pull request
01
Import
// From the package: a build keeps only what it uses.
import { Skeleton } from "@qeetrix/react";
// Or from its own path.
import { Skeleton } from "@qeetrix/react/skeleton";02
Props
And every native attribute of the element it renders.
| Prop | Type | Default | What it does |
|---|---|---|---|
variant | "text" | "block" | "circle" | "text" | One line, a card or image, or an avatar. |
lines | number | — | With text: a paragraph of this many lines, the last one shorter, at the lines' height. |
size | "sm" | "md" | "lg" | "xl" | "md" | With circle: an Avatar's diameter, 32px by default. |
style · className | … | — | Its size: inlineSize, blockSize. |
03
Parts
Each part carries a data-slot, for tests and placement.
| data-slot | Element | What it is |
|---|---|---|
skeleton | <span aria-hidden="true"> | data-variant; it pulses. |
skeleton-lines | <span aria-hidden="true"> | A paragraph's lines. |
04
Until it loads
Show the skeleton while there's nothing; never over content that's already there.
{profile ? <ProfileCard profile={profile} /> : <ProfileSkeleton />}