Skip to content

Skeleton

Edit on GitHub
@volvo-cars/css v2.3.0

Skeleton is a placeholder to show a loading state and the expected shape of a component.

image

  1. Animated gradient layer
  2. Background

When component data isn’t immediately available, you can use skeletons to improve the perceived responsiveness of the interface.

Displaying skeleton loading and loaded content

Displaying skeleton loading and loaded content.

Skeleton in light mode

Skeleton in light mode

Skeleton in dark mode

Skeleton in dark mode

  • If the page has a consistent layout pattern (e.g. tables, grids, lists,…)
  • To indicate loading state on late-loaded content (e.g. images, text, …), for example when fetching data from an API
  • If loading time is minimal (e.g. less than 1 second)
  • If the components will be conditionally rendered (e.g. a feature flagged component that may not be shown)

You can use the skeleton class to create your skeletons, make sure that the loading state recreates the expected shape of the component.

When using skeleton to replace text, the skeleton height should match the text size.

For example, if you have a 16pt font, the skeleton graphic should be 16px in height.

Body elements have an 8px vertical spacing between skeleton elements for multiple rows.

Heading elements have a 4px vertical spacing between skeleton elements for multiple rows.

Statement elements have a 4px vertical spacing between skeleton elements for multiple rows.

Example

Example with heading 2

Example with heading 2.

Example with font size 16

Example with font size 16.