Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Feedback

Skeleton

A grey placeholder that shows the shape of content while it loads.

Selector: mui-skeleton

Import
import { Skeleton } from '@mushilu-san/ui/feedback';
PreviewCode

Loading example…

Overview

Skeleton draws a pulsing block in the shape of the content to come: text lines, a rect or a circle. Set lines for several text lines and width or height to match the final layout.

The skeleton is decorative. The region that is loading should carry aria-busy="true", and a label or the final content tells the user when it is ready.

When to use

  • A card or list that takes a moment to load, so the layout does not jump.
  • Matching the final shape of a profile, article or table.

When not to use

  • An unknown wait with no shape to show. Use a spinner. Use Spinner instead.

Guidelines

Do

  • Match the size of the skeleton to the content it replaces.
  • Remove the skeleton as soon as the content is ready.

Don't

  • Do not leave skeletons on screen after a failed load. Show an error instead.

Accessibility

Roles and attributes

ElementRoleNotes
host—Decorative. Set aria-busy="true" on the region that is loading.
  • Reduced motion stops the pulse. Screen readers do not read skeleton blocks.

API

Skeleton

Selector: mui-skeleton

NameTypeDefaultDescription
variant'circle' | 'text' | 'rect''text' Shape of the placeholder: `text` lines, a `rect` or a `circle`. Default `text`.
widthstring | undefined— CSS size, e.g. "200px" or "100%". For circle, used as the diameter.
heightstring | undefined— Height of the placeholder as a CSS length.
linesnumber1 Number of placeholder lines (text variant only).

CSS parts

  • ::part(item)
  • ::part(root)

Tokens

  • --mui-color-surface-raised
  • --mui-color-border
  • --mui-radius-md