Skeleton
Skeleton is a placeholder that simulates the layout of these elements/sections while the data is being loaded.
This feature improves the store's experience and perceived performance through loading placeholders.
Skeletons
are like an element's or section's wireframe. It's a placeholder
that simulates the layout of these elements/sections while data is being loaded.Instead of showing a blank page, displaying
Skeletons
while loading content makes the user feel like the store is more responsive and faster.Also by using
Skeletons
the store will be less likely to experience Cumulative Layout Shilf (or CLS).Overview
Example
Code
With Shimmer Effect
Without Shimmer Effect
Import
Import the component from @faststore/ui
_10import { Skeleton } from '@faststore/ui'
Import Styles into your FastStore project
To apply the styles of this component in your FastStore project, import the following into your stylesheet:
_10@import '@faststore/ui/src/components/atoms/Skeleton/styles.scss';
Follow the instructions in the Importing FastStore UI component styles tutorial.
Usage
_10<Skeleton size={{ width: '200px', height: '80px' }} borderRadius="32px" />
Props
Name | Type | Description | Default |
---|---|---|---|
testId | string | ID to find this component in testing tools (e.g.: cypress, testing library, and jest). | fs-skeleton |
loading | false | true | Control whether skeleton should be visible or not. | true |
shimmer | false | true | Control whether the shimmer effect should be displayed or not. | true |
size* | Size | Specifies the skeleton element size (width, height). | |
border | "regular" | "pill" | "circle" | Specifies the skeleton element border radius ('regular' | 'pill' | 'circle'). | |
borderRadius | string | Custom border radius for skeleton elements. |
Design Tokens
Local token | Default value/Global token linked |
---|---|
--fs-skeleton-bkg-color | var(--fs-color-disabled-bkg) |
--fs-skeleton-border-radius | var(--fs-border-radius) |
Nested Elements
Shimmer
Local token | Default value/Global token linked |
---|---|
--fs-skeleton-shimmer-width | 50% |
--fs-skeleton-shimmer-height | 100% |
--fs-skeleton-shimmer-bkg-color | rgb(255 255 255 / 20%) |
--fs-skeleton-shimmer-box-shadow | 0 0 var(--fs-spacing-5) var(--fs-spacing-5) var(--fs-skeleton-shimmer-bkg-color) |
--fs-skeleton-shimmer-transition-timing | 850ms |
--fs-skeleton-shimmer-transition-function | linear |
--fs-skeleton-shimmer-transition-iteration | infinite |
Customization
For further customization, you can use the following data attributes:
data-fs-skeleton
data-fs-skeleton-shimmer