Rost

← All components

component

Spinner

Something is working and you can't tell how long it'll take. A grey ring with a green quarter that turns.

In code Contract: review Guidance: proposed Contract on GitHub Figma 742:21 As markdown
Small
Medium

Install

npx github:Runceanu/rost add spinner

It lands in src/rost/spinner/, with what it needs and its contract. Install has the rest.

When to use

  • A short wait you can't measure

    Saving, sending, signing in: a second or two with no way to say how far along it is.

  • Inside a button

    In place of the button's icon while its action runs, at small. Keep the label, and disable the button.

When not to use

  • Waits you can measure

    An upload or an import with a count. That's Progress.

    Use Progress

  • Content that's loading

    A list or a card on its way. Show its shape with Skeleton, so the page doesn't jump.

    Use Skeleton

Behaviour

A grey ring with a green quarter turning once every 600ms. For someone who's asked for less motion it turns five times slower; I didn't stop it, because a still spinner looks like something broke. The picture in Figma is its first frame.

Accessibility

  • Element

    <span role="status">, so the label is read when it appears.

  • Name

    label. Say what's happening, not "Spinner".

  • Colour

    The green arc is 9:1 on the dark page. The grey ring is decoration.

Content

The label in sentence case, as a present participle: "Saving".

Props

PropTypeValuesDefault
size enum small · medium medium
label string Loading

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

displayinline-block · positionrelative · flex-shrink0 · vertical-alignmiddle

track

  • border-style solid no token yet
  • border-width 2px spacing/outline/medium
  • border-color #3a3a3a spinner/track
  • border-radius 10000px spacing/radius/full

positionabsolute · inset0

arc

  • border-style solid no token yet
  • border-width 2px spacing/outline/medium
  • border-top-color #00d669 spinner/arc
  • border-radius 10000px spacing/radius/full
  • animation-duration 600ms motion/duration/slower

positionabsolute · inset0 · border-colortransparent · animation-namerost-spinner-turn · animation-timing-functionlinear · animation-iteration-countinfinite

Changes by variant

2 variants. Each table is what one thing changes with: a column per size, a row per property. Where every row starts with the same token path, it's written once, under the property.

Follows size

PropertySmallMedium
root.heightspacing/size/… 2xsmall 16px xsmall 20px
root.widthspacing/size/… 2xsmall 16px xsmall 20px