component
Text
Rost's type ramp as one component, from the 64px page title down to the 12px label.
Rost
DisplayComponents
HeadlineValues
Sub-headlineWhere things belong.
LedeEvery value comes from a token.
BodyEvery value comes from a token.
ParagraphLabelEyebrowimport { Text } from 'rost/components/text/Text'
<Text variant="eyebrow" as="span">Foundations</Text>
<Text variant="display" as="h1">Tokens</Text>
<Text variant="lede">Every value comes from one of these.</Text>
<Text tone="secondary">The names are the CSS variables.</Text> src/components/text/Text.tsx
import type { ElementType, HTMLAttributes, ReactNode } from 'react'
import './text.css'
export type TextVariant = 'display' | 'headline' | 'sub-headline' | 'lede' | 'body' | 'paragraph' | 'label' | 'eyebrow'
export interface TextProps extends HTMLAttributes<HTMLElement> {
/** The size, from the ramp. */
readonly variant?: TextVariant
/** The colour. Left out, the colour around it. */
readonly tone?: 'primary' | 'secondary' | 'tertiary' | 'positive' | 'warning' | 'negative'
/** Left out, the variant's own weight. */
readonly weight?: 'regular' | 'medium'
/** The element, by meaning: `h1`, `h2`, `p`, `span`. */
readonly as?: ElementType
readonly children?: ReactNode
}
const b = 'rost-text'
/** Words, at one size of Rost's ramp. Built from contracts/text.contract.yaml. */
export function Text({ variant = 'body', tone, weight, as: As = 'p', className, children, ...rest }: TextProps) {
const cls = [b, `${b}--variant-${variant}`, tone && `${b}--tone-${tone}`, weight && `${b}--weight-${weight}`, className].filter(Boolean).join(' ')
return <As className={cls} {...rest}>{children}</As>
}
The source for everything on this page: contracts/text.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: text
name: Text
kind: component
status: review
summary: Rost's type ramp as one component, from the 64px page title down to the 12px label.
category: display
related: [ link, code ]
source:
tool: figma
fileKey: 1Zy0wiWKXQAvsfDBX3KR0d
nodeId: "705:29"
url: https://www.figma.com/design/1Zy0wiWKXQAvsfDBX3KR0d/UI-Kit-v01?node-id=705-29
extractedAt: "2026-11-04"
extractedBy: hand
frozenAt: "2026-11-04"
props:
variant:
type: enum
values: [ display, headline, sub-headline, lede, body, paragraph, label, eyebrow ]
default: body
notes: "The size. Figma's text styles, plus `lede` for a page's opening line and `eyebrow` for the small capitals over a title."
tone:
type: enum
values: [ primary, secondary, tertiary, positive, warning, negative ]
notes: "The colour, from `non-interactive/foreground`. Left out, it's the colour around it. The last three are for words that carry a status, like a value with a token, one with a suggested token, and a gap."
weight:
type: enum
values: [ regular, medium ]
notes: Left out, the variant's own weight. Medium for titles, regular for the rest.
as:
type: string
default: p
notes: "The element. Pick by meaning (`h1`, `h2`, `p`, `span`), not by size: the variant does the size."
children: { type: slot }
elements:
root:
notes: "Whatever `as` says. No margins: the layout around it does the spacing."
styles:
font-family: { token: font-family/base, value: "'General Sans Variable'" }
font-size: { token: typography/body/font-size, value: 16px }
line-height: { token: typography/body/line-height, value: 22px }
letter-spacing: { token: typography/body/letter-spacing, value: 0px }
font-weight: { token: typography/body/font-weight/regular, value: "400" }
variants:
- when: { variant: display }
figmaNode: "705:13"
elements:
root:
font-size: { token: typography/display/font-size, value: "64px" }
line-height: { token: typography/display/line-height, value: "72px" }
letter-spacing: { token: typography/display/letter-spacing, value: "0px" }
font-weight: { token: typography/display/font-weight/medium, value: "500" }
text-wrap: { value: "balance", assert: false }
- when: { variant: headline }
figmaNode: "705:15"
elements:
root:
font-size: { token: typography/headline/font-size, value: "56px" }
line-height: { token: typography/headline/line-height, value: "64px" }
letter-spacing: { token: typography/headline/letter-spacing, value: "0px" }
font-weight: { token: typography/headline/font-weight/medium, value: "500" }
text-wrap: { value: "balance", assert: false }
- when: { variant: sub-headline }
figmaNode: "705:17"
elements:
root:
font-size: { token: typography/sub-headline/font-size, value: "40px" }
line-height: { token: typography/sub-headline/line-height, value: "48px" }
letter-spacing: { token: typography/sub-headline/letter-spacing, value: "0px" }
font-weight: { token: typography/sub-headline/font-weight/medium, value: "500" }
text-wrap: { value: "balance", assert: false }
- when: { variant: lede }
figmaNode: "705:19"
elements:
root:
font-size: { token: typography/font-size/22, value: "22px" }
line-height: { token: typography/line-height/32, value: "32px" }
letter-spacing: { token: typography/letter-spacing/letter-spacing, value: "0px" }
font-weight: { token: typography/font-weight/regular, value: "400" }
text-wrap: { value: "pretty", assert: false }
max-width: { value: "40ch", assert: false, notes: "An opening line reads best short." }
- when: { variant: body }
figmaNode: "705:21"
elements:
root:
font-size: { token: typography/body/font-size, value: "16px" }
line-height: { token: typography/body/line-height, value: "22px" }
letter-spacing: { token: typography/body/letter-spacing, value: "0px" }
font-weight: { token: typography/body/font-weight/regular, value: "400" }
text-wrap: { value: "pretty", assert: false }
- when: { variant: paragraph }
figmaNode: "705:23"
elements:
root:
font-size: { token: typography/paragraph/font-size, value: "14px" }
line-height: { token: typography/paragraph/line-height, value: "20px" }
letter-spacing: { token: typography/paragraph/letter-spacing, value: "0px" }
font-weight: { token: typography/paragraph/font-weight/regular, value: "400" }
text-wrap: { value: "pretty", assert: false }
- when: { variant: label }
figmaNode: "705:25"
elements:
root:
font-size: { token: typography/label/font-size, value: "12px" }
line-height: { token: typography/label/line-height, value: "14px" }
letter-spacing: { token: typography/label/letter-spacing, value: "0px" }
font-weight: { token: typography/label/font-weight/regular, value: "400" }
- when: { variant: eyebrow }
figmaNode: "705:27"
elements:
root:
font-family: { value: "'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace", notes: "Rost has no mono family token yet. Where JetBrains Mono isn't loaded, the system mono stands in." }
font-size: { token: typography/label/font-size, value: "12px" }
line-height: { token: typography/label/line-height, value: "14px" }
font-weight: { token: typography/font-weight/regular, value: "400" }
letter-spacing: { value: "0.1em", notes: "Capitals need air. In em so it follows the size." }
text-transform: { value: "uppercase" }
color: { token: non-interactive/foreground/tertiary, value: "#999999" }
- when: { tone: primary }
elements:
root:
color: { token: non-interactive/foreground/primary, value: "#ededed" }
- when: { tone: secondary }
elements:
root:
color: { token: non-interactive/foreground/secondary, value: "#d3d9d5" }
- when: { tone: tertiary }
elements:
root:
color: { token: non-interactive/foreground/tertiary, value: "#999999" }
- when: { tone: positive }
elements:
root:
color: { token: non-interactive/foreground/positive/base, value: "#00d669" }
- when: { tone: warning }
elements:
root:
color: { token: non-interactive/foreground/warning/base, value: "#fda50d" }
- when: { tone: negative }
elements:
root:
color: { token: non-interactive/foreground/negative/base, value: "#f2705f" }
- when: { weight: regular }
elements:
root:
font-weight: { token: typography/font-weight/regular, value: "400" }
- when: { weight: medium }
elements:
root:
font-weight: { token: typography/font-weight/medium, value: "500" }
guidance:
status: proposed
use:
- title: Every line of words
text: "Titles, paragraphs, captions, the small print under a table. If it's words on a page and not inside another component, it's Text."
show: variant=body
- title: Titles by meaning
text: "`as=\"h1\"` for the page's title, `h2` for its sections, whatever their size. A small section title is `variant=eyebrow as=h3`."
show: variant=display
avoid:
- title: Words inside a component
text: "Inside a Button, a Badge or a TableItem. They bring their own type."
- title: Making up a size
text: "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.
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,h2for its sections, whatever their size. A small section title isvariant=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
assays. Headings go in order: oneh1, thenh2, thenh3. - Colour
Every tone is 4.5:1 or better on the page and on the secondary plate, in both themes. The tightest are
tertiaryin light, 4.6:1 on the plate, andnegativein 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
| Prop | Type | Values | Default |
|---|---|---|---|
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-size16pxtypography/body/font-size -
line-height22pxtypography/body/line-height -
letter-spacing0pxtypography/body/letter-spacing -
font-weight400typography/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
| Property | Display | Headline | Sub-headline | Lede | Body | Paragraph | Label | Eyebrow |
|---|---|---|---|---|---|---|---|---|
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
| Property | Display | Headline | Sub-headline | Lede | Body | Paragraph |
|---|---|---|---|---|---|---|
root.text-wrap | balance | balance | balance | pretty | pretty | pretty |
Follows tone
In 7 variants
| Property | Primary | Secondary | Tertiary | Positive | Warning | Negative |
|---|---|---|---|---|---|---|
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, monospaceno token yet -
root.text-transformuppercaseno token yet
Lede
-
root.max-width40chFigma frame size