Skeleton
ProA placeholder in the shape of loading content, pure CSS with pulse or shimmer. Not an M3 component (@windmorph/react-pro).
import { Skeleton, SkeletonGroup } from '@windmorph/react-pro';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Props
Skeleton 11 props
The shape:
rectangle(full width and 96px tall) orcircle(40px), sized with classes; ortext, lines as tall as thetypescalerole's line height (linesof them, the last of several 60% wide).A rectangle's aspect ratio (
16/9,"4/3",1): it takes that shape at its width instead of the 96px height, standing for a picture, a video or a card's image before it loads, so nothing moves when it arrives. Rectangles only: a circle is always 1:1, and ignores it. In a flex row that stretches its items, align it to the start (self-start), or the row's height wins over the ratio.cornertype"none" | "extra-small" | "small" | "medium" | "large" | "extra-large" | "full"default "small" (extra-smallfor text lines,fullfor circles)Corner from the M3 shape scale, measured on the visible bar.
The fill's colour role:
surface-container-highestreads on every surface up tosurface-container;surface-container-highis a subtler fill forsurfaceandsurface-container-low.Overrides the animation set by the enclosing
SkeletonGroup. Left out, it follows the group, or pulses outside one.The placeholder's
<span>. Its other props (id,style,data-*) go to it too.typescaletype"display-large" | "display-medium" | "display-small" | "headline-large" | "headline-medium" | "headline-small" | "title-large" | "title-medium" | "title-small" | "body-large" | "body-medium" | "body-small" | "label-large" | "label-medium" | "label-small"default"body-medium"The type-scale role of the text it stands in for.
Number of lines; the last of several is 60% wide.
Classes for each part; they win over the component's own (
cn()).Classes for the root element, merged with the component's own (yours win).
Inline styles for the root element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
SkeletonGroup 8 props
What is loading, read once by assistive technology, for example "Loading businesses". Its live region goes into the page first and the label follows a moment later, so it's announced when the group appears after the page has loaded.
The animation of every skeleton inside.
The element to render. With
lithe group is a list item holding the label and a busydiv, since a list may hold only list items.The skeletons (and anything else) in the region.
The busy element. Its other props (
id,style,aria-*,data-*) go to it too.
Classes for each part; they win over the component's own (
cn()).The busy element holding the skeletons;
classNamegoes here too.The visually hidden loading label, rendered just before the busy element (inside the list item, before it, when
as="li"), so its announcement isn't held back.With
as="li", the list item that holds the label and the busy element (adiv). The item is what the list lays out;classNameand the other props go on the busy element.
Classes for the root element, merged with the component's own (yours win).
Inline styles for the root element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
Spec status
Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.
| Item | Status | Details |
|---|---|---|
| Variant: rectangle, circle, text | Built | Variant · Variants, Animations |
| Animation: pulse, shimmer, none | Built | Configuration · Animations |
| Colour: surface-container-highest and surface-container-high | Built | Configuration · Variants |
| Text lines sized to the type scale | Built | Configuration · Variants, Cards |
A picture's or video's shape (ratio) | Built | Configuration · Ratios |
| Placeholder for a list of cards | Built | Use case · Cards |
Variant: rectangle, circle, text
BuiltVariant · Variants, Animations
Animation: pulse, shimmer, none
BuiltConfiguration · Animations
Colour: surface-container-highest and surface-container-high
BuiltConfiguration · Variants
A picture's or video's shape (
Builtratio)Configuration · Ratios
Placeholder for a list of cards
BuiltUse case · Cards
M3 Expressive specs
- Shape
rounded-corner-small- Variants
rectangle, text, circle
Theming & tokens
- The fill is
surface-container-highest(orsurface-container-highwithcolor="surface-container-high"), so it follows every theme, mode and contrast level. - A rectangle is 96px tall unless its class sets a height;
ratio("16/9","4/3",1) gives it the shape of the picture or video it stands for at its width instead, so nothing moves when that arrives. - Corners come from the shape scale (
corner); text lines take the line height of a type-scale role, and a line's corner is measured on its visible bar. - The pulse and the shimmer ease on the slow effects spring. The shimmer's highlight is
on-surfaceat the hover state-layer opacity. - Set the tokens below on a skeleton or any ancestor. Each skeleton carries
data-tokens="wm-skeleton", withdata-coloranddata-cornerpicking the defaults, so a token set on a parent overrides every colour and corner.skeletonStylesno longer hascolororcornervariants: the tokens hold them.
| Variable | Default | Paints |
|---|---|---|
--wm-skeleton-fill | var(--md-sys-color-surface-container-highest)Varies with color. | The placeholder: surface-container-highest, or surface-container-high with `color="surface-container-high"`. |
--wm-skeleton-corner | var(--md-sys-shape-corner-small)Varies with corner. | The corners, measured on the visible bar: the `corner` prop (small; extra-small for text lines, full for circles). |
--wm-skeleton-highlight | color-mix(in srgb, var(--md-sys-color-on-surface) calc(var(--md-sys-state-hover-state-layer-opacity) * 100%), transparent) | The shimmer’s sweep: on-surface at the hover state-layer opacity. |
--wm-skeleton-period | 1s | How long each pulse takes (a sweep takes 1.5 times as long). M3 has no token for a loop’s period, so it is the component’s own. |