Rost

← All components

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.

In code Contract: review Guidance: proposed Contract on GitHub Figma 733:160 As markdown
Text
Circle
Block

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.

    Use 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

PropTypeValuesDefault
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 #3a3a3a skeleton/background
  • animation-duration 1.8s no token yet
  • animation-timing-function ease-in-out motion/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

PropertyTextCircleBlock
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%