Skeleton
Show a placeholder while content is loading.
Anatomy#
Usage#
Use Skeleton to reserve space for content while it loads. Match the placeholder’s dimensions and shape to the content it will replace. For measurable task completion, use Progress.
Size and appearance#
Skeleton renders one <div> with a muted background, medium corners, and a pulse animation. Set its
dimensions with class or an object style, and use utilities such as rounded-full to change its
shape.
Native div attributes and children go to the root. Skeleton adds no ARIA attributes or roles, so
add them to the surrounding region when assistive technology needs a loading state.
Animation variants#
The default animation="pulse" fades the placeholder in and out. Use animation="shimmer" for a linear
gradient sweep across the placeholder. Both animations respect the user’s reduced-motion preference.
Shimmer uses Moraine’s loop duration, which defaults to two seconds. Set --mo-anim-duration-loop
or --mo-anim-duration in style to change its speed; --mo-anim-duration takes precedence.
Configure skeleton.defaultVariants.animation in your Theme to set the default animation across your
application.
Examples#
Avatar#
Match a circular avatar and two text lines so the loaded row does not shift.
Card#
Keep Card anatomy and replace title, description, and media with Skeleton.
Text#
Stack full-width bars and shorten the last line to mimic wrapping text.
Form#
Reserve label and control heights so the form layout is stable while values load.
Table#
Repeat a row of bars for each pending record.
Shimmer#
Use animation="shimmer" when a sweep reads better than a pulse. Both animations honor reduced
motion.
API Reference#
Props#
Renders a <div> element by default.