Dojo NG is being built in the open, one section at a time — follow along on Heptapod.

API REFERENCE · FEEDBACK

<dj-skeleton>

A loading placeholder that stands in for content while it loads.

Try it in the playground

@dojo-ng/skeleton · v0.1.1

npm install @dojo-ng/skeleton

import "@dojo-ng/skeleton";

Size and shape

  • Style the host with CSS; there are no shape properties. It is display: block, 1em high by default, with the theme's border radius.
  • For a line of text, give it a short height and a width. For an avatar, make it square and add border-radius: 50%.
  • effect="sheen" (the default) shows a moving sheen; effect="none" shows a still surface.

Accessibility

  • The skeleton is always aria-hidden="true", because it is decoration.
  • Mark the region that is loading with aria-busy="true" until the real content arrives. Screen readers then announce the loading state once for the region, not once per placeholder.
  • Under prefers-reduced-motion, the sheen does not move, whatever effect says.

Properties

PropertyAttributeTypeDefault
effectLoading animation: a sweeping sheen, or none for a static placeholder. effect reflected "sheen""none" "sheen"

CSS parts

Style these with dj-skeleton::part(name).

PartDescription
basethe placeholder surface