Skeleton
This component displays a placeholder preview of components while data isnβt available. Its form will depend on said data.
Basic Usage
import { Skeleton } from '@krakentech/coral';
<Skeleton />Properties
animation
<Skeleton animation="wave" width={100} height={100} variant="rectangular" />width / height
<Skeleton height={250} width={250} variant="rectangular" />variant
<Skeleton height={250} width={120} variant="rounded" />Full Example
An pre-built example of a page that utilises Skeleton
When using the text variant it is important to place the Skeleton inside of a Typography parent, to ensure that the size is inferred correctly. Note, that while you can set the width manually, any manual height values will be ignored for the text variant, since the height is set to 1em. If the paragraph is expected to have multiple lines, you can place multiple Skeletons inside of a Typography.
<Stack flexDirection="column" gap="md">
<Typography variant="h1">
<Skeleton width={300} />
</Typography>
<Stack flexDirection="row" gap="lg" justifyContent="space-between">
<Skeleton width={100} height={100} variant="circular" />
<Skeleton height={100} variant="rounded" />
</Stack>
<Typography variant="body1">
<Skeleton />
<Skeleton />
<Skeleton width={200} />
</Typography>
<Typography variant="body1">
<Skeleton />
</Typography>
<Stack flexDirection="column" gap="md" flexWrap="wrap">
<Skeleton height={50} width={200} variant="rectangular" />
</Stack>
</Stack>Full API
Design
Good to know
In an ideal world a user would never see this component but its existence is purely for the worst case scenario where the content wonβt load quick enough, the purpose of a skeleton is to reduce use frustration during load time. The logic being, seeing something is better than seeing a blank screen.
Component breakdown
- Corner radius: 4px
- Colour: Purple Haze