import Skeleton from "@intility/bifrost-react/Skeleton";Introduction
Skeleton provides elements that can be used as placeholders while your content is loading. The idea is that the interface should "jump" as little as possible, which you often can get with loading spinners.
<Skeleton repeat={N}>Repeats its childrenNtimes<Skeleton.Text />Text line (size follows text height)<Skeleton.Rect />Rectangle (any arbitrary size oraspectRatio)
Text placeholder
Let's say you have some content loading that should render as a heading and a paragraph with a couple of lines of text, you can create equivalent placeholders while waiting for the data to load.
Rectangle
Use <Skeleton.Rect> for a surface that isn't text, like an image. Set a
width and height, or use aspectRatio to reserve space that scales with its
container.
Can be combined with border radius (like .bf-radius):
Cards
In combination with other components, like <Box>, you can
create a wireframe of how your page will look before any data has been received.
These examples match the article cards in the Box docs.
<Skeleton.Rect> has no corner radius by default. Use the bf-radius-* utility
classes for uniform radius, or style for individual corners. This is needed
when a placeholder sits at the edge of a rounded <Box>.
Vertical
Horizontal
Circle image
Interactive demo
Ideally the cards don't move or change size between loading and settled state.
Table cells
By default, HTML tables stretch columns to acommodate the content of its cells. In order to avoid "jumping" on load you can apply widths to table header cells.