Rost

← All components

component

Stat

One figure that matters, with what it is and how it moved. A label, the number in title type, and a line in green or red.

In code Contract: review Guidance: proposed Contract on GitHub Figma 743:40 As markdown
Paid this month€12,480Up 12% on October
Positive
Paid this month€12,480Down 8% on October
Negative
Paid this month€12,480Same as October
Neutral

Install

npx github:Runceanu/rost add stat

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

When to use

  • A number to watch

    The few figures a dashboard is for: paid this month, tax set aside, outstanding.

When not to use

Behaviour

Three lines: what, how much, how it moved. The delta takes the tone's colour; its words carry the meaning.

Accessibility

  • Element

    A <div>. Put it in a list (<ul>) when there are several, so they're counted.

  • Name

    The label, read before the figure.

  • Colour

    The delta is 9:1 green or 6:1 red on the dark page, and its words say up or down.

Content

Label in sentence case, figure formatted for the reader, delta as a sentence: Up 12% on October.

Props

PropTypeValuesDefault
label slot
value slot
delta slot
tone enum positive · negative · neutral neutral

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

  • gap 4px spacing/gap/2xsmall

displayflex · flex-directioncolumn

label

  • font-family 'General Sans Variable' font-family/base
  • font-weight 400 typography/label/font-weight/regular
  • font-size 12px typography/label/font-size
  • line-height 14px typography/label/line-height
  • letter-spacing 0px typography/label/letter-spacing
  • color #d3d9d5 stat/label

value

  • font-family 'General Sans Variable' font-family/base
  • font-weight 500 typography/title/font-weight/medium
  • font-size 24px typography/title/font-size
  • line-height 32px typography/title/line-height
  • letter-spacing 0px typography/title/letter-spacing
  • color #ededed stat/value

delta

  • font-family 'General Sans Variable' font-family/base
  • font-weight 500 typography/label/font-weight/medium
  • font-size 12px typography/label/font-size
  • line-height 14px typography/label/line-height
  • letter-spacing 0px typography/label/letter-spacing

Changes by variant

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

Follows tone

PropertyPositiveNegativeNeutral
delta.colorstat/delta/… positive #00d669 negative #f2705f neutral #999999