Backpack UI
Components
Skeleton

Skeleton

The Skeleton component is a versatile component designed to act as a placeholder while content is loading or before the content is available. It provides visual feedback and reduces the perceived loading time for users, improving the overall user experience. It is inspired by the Material-UI skeleton component and can be used in various scenarios such as text, cards, and images.

Importing


_10
import { Skeleton } from '@ef-global/backpack/Skeleton';

Props

NameTypeDefaultDescription
variantSkeletonVariant'text'Defines the shape of the skeleton: 'circular', 'rectangular', or 'text'.
animatebooleantrueDetermines whether the skeleton should have a pulsing animation effect.
heightstringSets the height of the skeleton.
widthstringSets the width of the skeleton.
classNamestringCustom CSS class name for the skeleton.
childrenReact.ReactNodeChild elements to be rendered within the skeleton component.

Usage

Here are some examples of the Skeleton component in use:

With Text

header1

header2

header3

header4

header5

header6

body

bodySmall


_24
<Text variant={'header1'}>
_24
<Skeleton />
_24
</Text>
_24
<Text variant={'header2'}>
_24
<Skeleton />
_24
</Text>
_24
<Text variant={'header3'}>
_24
<Skeleton />
_24
</Text>
_24
<Text variant={'header4'}>
_24
<Skeleton />
_24
</Text>
_24
<Text variant={'header5'}>
_24
<Skeleton />
_24
</Text>
_24
<Text variant={'header6'}>
_24
<Skeleton />
_24
</Text>
_24
<Text variant={'body'}>
_24
<Skeleton />
_24
</Text>
_24
<Text variant={'bodySmall'}>
_24
<Skeleton />
_24
</Text>

With Content Card


_17
<ContentCard href='' shadow='off'>
_17
<Skeleton
_17
style={{ paddingTop: '56.25%' }}
_17
variant='rectangular'
_17
data-slot='CardImage'
_17
/>
_17
<Skeleton
_17
style={{
_17
flex: '1',
_17
maxWidth: '70%',
_17
}}
_17
data-slot='CardTitle' />
_17
<div data-slot='CardBody'>
_17
<Skeleton style={{ maxWidth: '100%' }} />
_17
<Skeleton style={{ maxWidth: '30%' }} />
_17
</div>
_17
</ContentCard>

With Teaser Card

Image alternate

_20
<TeaserCard className={styles.teaserCardSkeleton} href='' shadow='off'>
_20
<Skeleton
_20
style={{ paddingTop: '56.25%' }}
_20
variant='rectangular'
_20
data-slot='CardImage'
_20
/>
_20
<Skeleton
_20
style={{
_20
flex: '1',
_20
backgroundColor: 'hsl(0, 0%, 95%)',
_20
maxWidth: '80%',
_20
}}
_20
animate={false}
_20
data-slot='CardTitle'
_20
/>
_20
<div data-slot='CardBody'>
_20
<Skeleton style={{ maxWidth: '100%' }} />
_20
<Skeleton style={{ maxWidth: '30%' }} />
_20
</div>
_20
</TeaserCard>