Skeleton

stable 0.8 kB
<hk-skeleton>

Placeholders shaped like the content they stand in for, so the layout does not shift when data lands. Three motions: a travelling sheen, a soft pulse, or none at all.

#loading#placeholder

Live demo

Running in this page — interact with it.

Inputs

NameTypeDefaultDescription
loadingbooleantrueShows placeholders; projects the real content when false.
motion'shimmer' | 'pulse' | 'none''shimmer'How the placeholder animates.
width / heightstring'100%' / '1em'Box size. Match the real element to avoid a shift.
radiusstring'0.375rem'Corner radius. Use 50% for an avatar.
linesnumber1Repeats the line primitive, tapering the last one.

Theming

Component tokens, each falling back to a global one:

PropertyDefaultControls
--hk-skeleton-base#e8ecf1Placeholder fill.
--hk-skeleton-sheen#f6f8faColour of the travelling highlight.
--hk-skeleton-speed1.4sSweep duration.

Accessibility

  • The container is aria-busy while loading, so assistive tech knows content is pending rather than missing.
  • Placeholders are aria-hidden — a screen reader should hear "loading", not a dozen empty boxes.
  • prefers-reduced-motion drops to the static box rather than a slowed-down animation.

More in Feedback