Raft Design System

Components · Feedback

Skeleton

A gray placeholder in the shape of the content that is loading, for lists, cards and panels whose layout is known.

StableAlso called Placeholder
import { Skeleton } from "@botiverse/raft-ui";

A skeleton holds the place of content that is still loading: square blocks where avatars and tiles will be, bars where text will be. Use it when a list, card or panel loads for the first time and its layout is known. Which loading indicator fits which wait is in Choosing a component.

skeleton/compositions/preview

When to use

SituationUse
The layout of what is loading is knownSkeleton
The wait has no layout to hold, or happens in a small areaSpinner
The percentage is knownProgress
Loading finished and there is nothingEmptyState
Loading failedAn error at its scope (Feedback)

Variants

VariantUse for
variant="line"A line of text
variant="block"A thumbnail, card or any other block; size it with className
variant="circle"An avatar or tile. Despite its name it is square, like the avatar it stands for
skeleton/compositions/basic

Accessibility

  • Skeleton is aria-hidden. Mark the region that is loading with aria-busy="true" until the content arrives, so assistive technology doesn't read an empty region as empty.

Rules

  • Give the skeleton the shape of the content it stands for: square for avatars and tiles, bars for text. Keep it rough: the layout and the common sizes, never details only the data knows. The size rule, the 1-second wait before it shows and the rule against swapping placeholders are in Feedback.
  • For the rows of a list, use the row's own skeleton rather than arranging Skeletons by hand: InboxItemSkeleton (InboxItem) and ListRowSkeleton (ListRow) are built from the row's parts, so they keep its size, and stay flat like it.

API

Skeleton

PropTypeDefault
variant"circle" | "line" | "block""block"

Also takes the attributes of its element.

Changes