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 variant="pulse" fades the placeholder in and out. Use variant="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.variant in your Theme to set the default animation across your
application.
Examples#
Reserve a profile row#
Match a circular avatar and two text lines so the loaded row does not shift.
Placeholder a media card#
Keep Card anatomy and replace title, description, and media with Skeleton.
Hold space for a paragraph#
Stack full-width bars and shorten the last line to mimic wrapping text.
Placeholder a settings form#
Reserve label and control heights so the form layout is stable while values load.
Placeholder a data table#
Repeat a row of bars for each pending record.
Shimmer a profile row while it loads#
Use variant="shimmer" when a sweep reads better than a pulse. Both animations honor reduced
motion.
API Reference#
Props#
Renders a <div> element by default.