component
Skeleton
Grey shapes where content is about to be, so the page doesn't jump when it arrives. A line of text, a circle or a block.
TextCircleBlockimport { Skeleton } from 'rost/components/skeleton/Skeleton'
<div aria-busy="true">
<Skeleton shape="circle" />
<Skeleton />
<Skeleton width="60%" />
</div> src/components/skeleton/Skeleton.tsx
import type { CSSProperties, HTMLAttributes } from 'react'
import './skeleton.css'
export interface SkeletonProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
readonly shape?: 'text' | 'circle' | 'block'
/** Any CSS width, so lines can be uneven like real text. */
readonly width?: string
/** A block's height. */
readonly height?: string
}
const b = 'rost-skeleton'
/**
* A grey shape where content is about to be. Hidden from screen readers: put
* `aria-busy` on whatever holds it. Built from contracts/skeleton.contract.yaml.
*/
export function Skeleton({ shape = 'text', width, height, className, style, ...rest }: SkeletonProps) {
const size: CSSProperties = shape === 'circle' ? {} : { ...(width ? { width } : {}), ...(shape === 'block' && height ? { height } : {}) }
return <span className={[b, `${b}--shape-${shape}`, className].filter(Boolean).join(' ')} aria-hidden="true" style={{ ...size, ...style }} {...rest} />
}
The source for everything on this page: contracts/skeleton.contract.yaml (opens in a new tab). The CSS, the docs and the checks in each app are built from it.
# yaml-language-server: $schema=../schema/component-contract.schema.json
schemaVersion: 2
id: skeleton
name: Skeleton
kind: component
status: review
summary: Grey shapes where content is about to be, so the page doesn't jump when it arrives. A line of text, a circle or a block.
category: feedback
related: [ progress, avatar, card ]
source:
tool: figma
fileKey: 1Zy0wiWKXQAvsfDBX3KR0d
nodeId: "733:160"
url: https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=733-160
extractedAt: "2026-11-16"
extractedBy: hand
frozenAt: "2026-11-16"
props:
shape:
type: enum
values: [ text, circle, block ]
default: text
notes: "`text` is a line of paragraph text, `circle` stands in for a medium Avatar, `block` for a picture or a chart."
width: { type: string, notes: "Any CSS width, so lines can be uneven like real text. A circle's size is fixed." }
height: { type: string, notes: "A block's height. 80px if you leave it." }
elements:
root:
notes: "A `<span>`, hidden from screen readers. Whatever holds the skeletons says it's loading (`aria-busy`)."
styles:
display: { value: block, assert: false }
flex-shrink: { value: "0", assert: false }
background: { token: skeleton/background, value: "#3a3a3a" }
animation-name: { value: rost-skeleton-pulse, assert: false }
animation-duration: { value: 1.8s, notes: "Three of motion/duration/slower: slow enough to read as waiting, not as an alarm." }
animation-timing-function: { token: motion/easing/in-out, value: ease-in-out }
animation-iteration-count: { value: infinite, assert: false }
animation-direction: { value: alternate, assert: false }
keyframes:
pulse:
from: { opacity: "1" }
to: { opacity: "var(--opacity-medium)" }
reducedMotion:
notes: "Still, for someone who asks for less motion. A grey shape says enough."
elements:
root:
animation-name: { value: none, assert: false }
variants:
- when: { shape: text }
figmaNode: "733:156"
elements:
root:
width: { value: 100%, assert: false }
height: { token: spacing/size/3xsmall, value: 12px, notes: "About the height of paragraph text's letters, not its line." }
border-radius: { token: spacing/radius/xsmall, value: 4px }
- when: { shape: circle }
figmaNode: "733:157"
elements:
root:
width: { token: spacing/size/medium, value: 40px }
height: { token: spacing/size/medium, value: 40px }
border-radius: { token: spacing/radius/full, value: 10000px }
- when: { shape: block }
figmaNode: "733:158"
elements:
root:
width: { value: 100%, assert: false }
height: { token: spacing/size/3xlarge, value: 80px }
border-radius: { token: spacing/radius/medium, value: 12px }
guidance:
status: proposed
use:
- title: Content on its way
text: "A list, a card or a table whose shape you know before its data arrives. Draw the shape, then swap it."
show: shape=text
avoid:
- title: Long waits
text: "Anything that takes more than a few seconds, or where you know how far along it is. That's **Progress**."
- title: Buttons
text: "A button that's working on something keeps its place and says so itself."
behaviour: |-
Plain grey shapes, matched to what's coming: give text lines uneven widths, the last one shorter. They fade slowly between full and 48%, and back, every 1.8 seconds. For someone who asks for less motion they stay still.
accessibility:
element: "A `<span aria-hidden=\"true\">`. Screen readers skip them."
name: "None. Put `aria-busy=\"true\"` on the part of the page that's loading, and take it off when the content is in."
colour: "Decoration, so no contrast minimum. It's the tertiary grey, which shows on the page and on a card."
Install
npx github:Runceanu/rost add skeleton It lands in src/rost/skeleton/, with what it needs and its contract. Install has the rest.
When to use
Content on its way
A list, a card or a table whose shape you know before its data arrives. Draw the shape, then swap it.
When not to use
Long waits
Anything that takes more than a few seconds, or where you know how far along it is. That's Progress.
Buttons
A button that's working on something keeps its place and says so itself.
Behaviour
Plain grey shapes, matched to what's coming: give text lines uneven widths, the last one shorter. They fade slowly between full and 48%, and back, every 1.8 seconds. For someone who asks for less motion they stay still.
Accessibility
- Element
A
<span aria-hidden="true">. Screen readers skip them. - Name
None. Put
aria-busy="true"on the part of the page that's loading, and take it off when the content is in. - Colour
Decoration, so no contrast minimum. It's the tertiary grey, which shows on the page and on a card.
Props
| Prop | Type | Values | Default |
|---|---|---|---|
shape | enum | text · circle · block | text |
width | string | | |
height | string | | |
Values
Straight from the contract. Each value sits next to its token, because six tokens here all come out as #3a3a3a and the colour alone can't tell you which one is right.
Never changes
root
-
background#3a3a3askeleton/background -
animation-duration1.8sno token yet -
animation-timing-functionease-in-outmotion/easing/in-out
displayblock · flex-shrink0 · animation-namerost-skeleton-pulse · animation-iteration-countinfinite · animation-directionalternate
Changes by variant
3 variants. Each table is what one thing changes with: a column per shape, a row per property. Where every row starts with the same token path, it's written once, under the property.
Follows shape
| Property | Text | Circle | Block |
|---|---|---|---|
root.border-radiusspacing/radius/… | xsmall 4px | full 10000px | medium 12px |
root.heightspacing/size/… | 3xsmall 12px | medium 40px | 3xlarge 80px |
root.width | 100% | spacing/size/medium 40px | 100% |