Rost

← All components

component

Text

Rost's type ramp as one component, from the 64px page title down to the 12px label.

In code Contract: review Guidance: proposed Contract on GitHub Figma 705:29 As markdown

Rost

Display

Components

Headline

Values

Sub-headline

Where things belong.

Lede

Every value comes from a token.

Body

Every value comes from a token.

Paragraph
Token coverage
Label
Components
Eyebrow

Install

npx github:Runceanu/rost add text

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

When to use

  • Every line of words

    Titles, paragraphs, captions, the small print under a table. If it's words on a page and not inside another component, it's Text.

  • Titles by meaning

    as="h1" for the page's title, h2 for its sections, whatever their size. A small section title is variant=eyebrow as=h3.

When not to use

  • Words inside a component

    Inside a Button, a Badge or a TableItem. They bring their own type.

  • Making up a size

    A font size of your own. If none of these fits, the ramp is missing a step, and I'd rather add it here.

Behaviour

One element, one size from the ramp, and no margins. tone and weight change only what they say. display, headline and sub-headline balance their lines, the longer ones wrap without leaving one word alone. Not done yet: the ramp doesn't step down on a phone. 64px is a lot on a 375px screen, so the Rost site steps display and sub-headline down itself for now. That belongs here, once I know the steps for the apps too.

Accessibility

  • Element

    whatever as says. Headings go in order: one h1, then h2, then h3.

  • Colour

    Every tone is 4.5:1 or better on the page and on the secondary plate, in both themes. The tightest are tertiary in light, 4.6:1 on the plate, and negative in dark, 6.2:1.

Content

Sentence case everywhere, titles too. eyebrow is written in sentence case and drawn in capitals, so screen readers don't spell it out.

Props

PropTypeValuesDefault
variant enum display · headline · sub-headline · lede · body · paragraph · label · eyebrow body
tone enum primary · secondary · tertiary · positive · warning · negative
weight enum regular · medium
as string p
children slot

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

  • font-family 'General Sans Variable' font-family/base
  • font-size 16px typography/body/font-size
  • line-height 22px typography/body/line-height
  • letter-spacing 0px typography/body/letter-spacing
  • font-weight 400 typography/body/font-weight/regular

Changes by variant

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

Follows variant

In 8 variants

PropertyDisplayHeadlineSub-headlineLedeBodyParagraphLabelEyebrow
root.font-sizetypography/… display/font-size 64px headline/font-size 56px sub-headline/font-size 40px font-size/22 22px body/font-size 16px paragraph/font-size 14px label/font-size 12px label/font-size 12px
root.letter-spacingtypography/… display/letter-spacing 0px headline/letter-spacing 0px sub-headline/letter-spacing 0px letter-spacing/letter-spacing 0px body/letter-spacing 0px paragraph/letter-spacing 0px label/letter-spacing 0px 0.1em
root.line-heighttypography/… display/line-height 72px headline/line-height 64px sub-headline/line-height 48px line-height/32 32px body/line-height 22px paragraph/line-height 20px label/line-height 14px label/line-height 14px

In 6 variants

PropertyDisplayHeadlineSub-headlineLedeBodyParagraph
root.text-wrap balance balance balance pretty pretty pretty

Follows tone

In 7 variants

PropertyPrimarySecondaryTertiaryPositiveWarningNegative
root.colornon-interactive/foreground/… primary #ededed secondary #d3d9d5 tertiary #999999 positive/base #00d669 warning/base #fda50d negative/base #f2705f

Follows variant and weight

Only in some variants

These don't change: they're just set in some variants and not others.

Eyebrow

  • root.font-family 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace no token yet
  • root.text-transform uppercase no token yet

Lede

  • root.max-width 40ch Figma frame size