Skeleton
Skeleton
Use a skeleton to hold the place of content that is still loading. The class needs no script, so it can be used in
server-rendered markup that paints before a page’s JavaScript runs. The PvSkeleton component renders this same class.
| Custom Property | Default Value | Description |
|---|---|---|
--skeleton-width |
100% | The width of the block |
--skeleton-height |
1.25rem (20px) | The height of the block |
| Class | Description |
|---|---|
pv-skeleton-xs, -sm, -lg, -xl |
Heights of 0.75rem, 1rem, 1.5rem and 2rem |
pv-skeleton-square |
As wide as it is tall |
pv-skeleton-circle |
As wide as it is tall, and round |
The sweep does not run when the user prefers reduced motion.
Example
Lines, a chip, a row and an avatar.
HTML
<div class="pv-skeleton pv-skeleton-sm" style="--skeleton-width: 60%"></div>
<div class="pv-skeleton pv-skeleton-sm" style="--skeleton-width: 40%"></div>
<div class="pv-skeleton" style="--skeleton-width: 172px"></div>
<div class="pv-skeleton" style="--skeleton-height: 46px"></div>
<div class="pv-skeleton pv-skeleton-xl pv-skeleton-circle"></div>