Skeleton Loader - React
import { SkeletonLoader } from '@sky-uk/ui-core';
The Skeleton Loader component is used to indicate that content is in the process of loading.
Props
SkeletonLoader
Prop | Type | Default | Description |
---|---|---|---|
$type | string | required | The $type prop is used to define which skeleton loader will be used. If set to a typography, the height is set to mock the relevant font. If set to rectangle, then the height and width can be determined by height and width |
$type
The $type
prop can be set to any typography size or rectangle
If using $type
as a typography size, the $height
of the skeleton loader is set and shouldn't be overwritten. This ensures that when SkeletonLoaders are stacked, they maintain the correct spacing to match the text.
If using $type="rectangle"
then the default height (50px) and width (100%) are applied.
Or define the size using the system modifiers as below.
Accessibility
When using a skeleton loader, it's important to ensure that assistive technologies properly convey its purpose. Since skeleton loaders do not contain meaningful content, they should be hidden from screen readers to prevent confusion.
Below is an example of how SkeletonLoaders
should be used on a page.
System Modifiers
The SkeletonLoader
component also accepts props applied using the following system modifiers: