Components/Feedback

Skeleton

Skeletons stand in for content that has not arrived yet, drawn in roughly the shape it will take. They tell the reader that something specific is coming and where it will land, so the page settles into its final layout instead of jumping once the content appears.

import { Skeleton } from '@growth-protocol-ai/alpha';

On this page

variant
size
Skeleton.tsxtsx
1import { Skeleton } from '@growth-protocol-ai/alpha';
2
3<Skeleton variant="text" size="sm" lines={3} />

When to use

Reach for a skeleton when you already know the shape of what is arriving and the wait is long enough for a reader to notice it — a card, a row of a table, a paragraph of copy. Draw it at the size and the count the real content will take: the habit that most often goes wrong is a placeholder that is only roughly right, which buys a second layout shift rather than saving the first.

When not to use

Do not reach for a skeleton when the shape of the response is unknown — a save, a search that may return anything, a request whose result you cannot predict. Spinner is the component for that, and what separates the two is what you can honestly promise: a spinner says only that something is happening, where a skeleton says what is coming and where it will land. A surface with nothing on its way at all is neither, and belongs to EmptyState.

variant3 values

What picks the variant is the shape of the thing being waited on, not how long the wait is. Reach for one only where that shape is actually known — a skeleton is a promise about what is coming, and one that guesses wrong is worse than a ring that says nothing.

text
block
inline
variantWhen to use
textA stack of bars standing in for lines of copy. The default, and the only variant lines applies to.
blockOne box at the width of its container and the height it is given — a chart, a thumbnail, a panel with a fetch of its own. It carries a floor of its own, so a block inside a container with no height is still visible.
inlineA short run inside a sentence, at the height of the text around it rather than the height size would give it. For the one value a paragraph is waiting on, where a bar on its own line would break the prose.

size5 values

Each size is a step of the type scale rather than a pixel count: the bar takes a font size, and the gap between bars is whatever leading is left over from the line height the scale pairs with it. The pairing is not always the same-named token — lg is H4 at 18/22, and takes --line-height-sm.

xs
sm
md
lg
xl
sizeWhen to use
xs12px on a 16px line. Body Small and Caption — table cells, metadata, a dense list row.
smThe default. 14px on a 22px line: Body Medium, which is the copy most of a product is written in.
md16px on a 24px line. Body Large and Sub2, for a lead paragraph or a roomier layout.
lg18px on a 22px line. H4 — a section heading above a stack of body bars.
xl20px on a 24px line. Sub1, the largest step here, for the title of a card or a panel.