Foundations
Typography
The two typefaces, the type scale and where each size and weight is used, the three text color tiers, the metric tokens, and the casing rules.
Raft uses two typefaces with separate jobs: Space Grotesk for what people say, Space Mono for what machines write. Hierarchy comes from size, weight and color, never from capitals.
Principles
- Space Grotesk is people; Space Mono is machines. Space Grotesk (variable, weights 300 to 700) sets messages, labels and titles. Space Mono (400 and 700) sets IDs, times, counts, runtimes, event lines, shortcuts and code.
- CJK falls back to the system face: PingFang SC, then Source Han Sans, for Chinese. A page in Traditional Chinese, Japanese or Korean (
<html lang="zh-TW">/"ja"/"ko") falls back to its own faces first, because the Simplified Chinese faces draw characters with mainland glyph shapes and have no Hangul. Mixed CJK and English text keeps the numbers, IDs and times in Space Mono. - No all caps, and sentence case everywhere. Write every label, title and line in sentence case, with capitals only for the first word and for names; see Casing.
Type scale
Each style sets a size and a line height; the bold styles also set their weight. The working styles have two sizes: a phone's, and a desktop's, from 768px (where the desktop layout begins, Responsive layout) when the main pointer is a mouse or a trackpad. A touch screen keeps the phone's sizes at any width (Spacing says why). The utility is the same on both, so a component never states a breakpoint for its type.
Field text and card titles have their own tokens, with the same two sizes (Metric tokens).
Desktop and phone
The desktop scale is Feishu's (Lark's) for PC: 16/24 for titles, 14/22 for everything people read, 12px for notes. The phone scale is Feishu's for mobile, where message text is 16/24 as well. People compare Raft with the chat tools they use all day, and on a desktop those set message text at 14px.
- A desktop is a wide screen with a mouse or a trackpad. The sizes switch on
(width >= 48rem) and (pointer: fine), the same query as the control heights, so a field's text and its height change together. A tablet used by touch keeps the phone's sizes: 16px field text stops iOS and iPadOS from zooming into a field on focus. - A desktop is read from further away, with more on screen. A conversation sits beside a sidebar and often a thread, so a line of text holds more words and a screen more messages at 14px. On a phone the screen is closer and one column fills it; 16px reads at the same apparent size.
- Judge a size with Chinese, not only with Latin. Chinese falls back to the system face, whose glyphs fill the em box: at 16px a line of Chinese reads larger than the same line in Space Grotesk, whose lowercase is about half its size. Check a change with a Chinese conversation open as well as an English one.
- Body, subhead and callout share 14/22 on a desktop. Feishu has no 13px or 15px step, and the scale doesn't need one: a name, a message and a preview differ there by weight and color, and a size step on top would make the three differences Color tiers rules out. On a phone they stay a step apart.
- Notes take an 18px line on a desktop, as footnote does on a phone. Feishu gives 12px notes a 20px line, but a note here is often two or three lines under a setting or a card, and at 20px those lines sit further apart than the 14/22 text above them, so the note reads looser than what it explains. Footnote, caption and mono meta share 12/18, so a time in Space Mono and a status in Space Grotesk on one line have the same box. The two faces also share a cap height (0.700em), so on one baseline their letters stand the same height (Text of different sizes on one line).
- Mono code stays 13/20. Space Mono is wider than Space Grotesk, so 13px code already sits level with 14px text, and its 20px line fits inside a 22px line of text.
- A control's label is 14px on a desktop, 13px on a phone. Feishu sets button text at 14px; footnote goes down to 12px there, so a 32px control's label has its own style,
text-control. - Hero, display, title and label don't change. They set sign-in and setup pages, which are the same on both, and the phone's tab bar.
- Density is the person's choice, not the default's. Someone who wants more on screen picks Small in the message-size setting. Don't make the default smaller to fit more.
Font families
fonts.css defines three families. Use them through the Tailwind utilities.
- Decide by who wrote it: text that is copied character for character, a time, a count or an identity marker is mono; anything a person says is sans.
- The trailing
#channel-nameof a thread's title is sans, intext-headlineat weight 400 andforeground-hint: it belongs to the title. - For scripts missing from Space Grotesk, the sans families try Arial and Helvetica Neue before the CJK faces. This keeps Cyrillic text out of CJK fonts with wide letter advances. Keep
system-uiafter the language-specific CJK families so the operating system does not replace their glyph choices. - The sans families fall back to PingFang SC, Hiragino Sans GB, Microsoft YaHei, Noto Sans SC and Noto Sans CJK SC (the name Linux distributions install it under) for Chinese, then the system face. Under
lang="zh-TW"(alsozh-HK,zh-MOandzh-Hant) they fall back to PingFang TC, Microsoft JhengHei and Noto Sans TC; underlang="ja"to Hiragino Sans, Yu Gothic UI, Meiryo and Noto Sans JP; underlang="ko"to Apple SD Gothic Neo, Malgun Gothic and Noto Sans KR.
Mixed CJK and Latin
- The browser spaces mixed text. raft-ui sets
text-autospace: normalon the root, so the browser draws a small gap (1/8 em) wherever Chinese, Japanese or Korean meets a Latin letter or a digit: a Chinese sentence that names Raft with no spaces around it reads as if it had them. Much of the text we show is written by people and agents, and their messages, names and titles often have no spaces; the interface strings can carry spaces, but other people's text can only be spaced at render time. Chromium starts fromno-autospace, so the root has to set it (stdrc, 2026-11-30, #proj-raft-ui:a84026d4). - The gap is drawn, not typed: copied text keeps exactly the characters it had, and where a space is already there no second one is added. Translations that put a space between Chinese and Latin can keep it.
- Code,
kbd,sampandpreturn it off (no-autospace): code is copied character for character, so it shows exactly the characters it has. - A browser without
text-autospaceshows the text as written, which is what every browser showed before.
Usage
- Pick the weight by purpose from 400, 500, 600 and 700; the scale sets only size and line height for the regular styles.
- Size the initials in an avatar at 11px, 13px, 15px, 22px or 40px, by avatar size; see Avatar.
- Set anything a machine produced in Space Mono, even inside a sentence:
#25,10:24,Claude Code, counts, event lines. - Set statistics meant for people in Space Grotesk.
Sizes by use
Weights by use
Color tiers
Text has three tiers. The tokens and their contrast are in Color.
- Read titles, the top of the sidebar, senders and names in list rows at the base tier. Let weight make the difference between them: titles and senders at 700, list rows at 600.
- Give a message two layers: its content (sender and text, at the base tier) and its notes (time, model, inline status, at the hint tier).
- Keep data and explanation in different parts. Data people read as the content, such as an agent's description or a channel's topic under a row's name, is at the base tier, in the component's data part (
ListRowSubtitle). A component's notes on its data (times, counts, IDs) are at the hint tier, in its meta part (ListRowMeta,MessageActionCardHeaderMeta). Of text people read, the muted tier holds the sentences written to explain something, and only aHelperTextreaches it: a consequence (consequence), who sees it (audience) or how to recover (recovery), in one of raft-ui's explanation slots orText.Sans variant="muted". It also holds the facts a choice row is compared by (a ChoiceList item'smeta, after its description): people choose by those, so they are never lighter than the description beside them. It also holds the labels, tabs and quoted text the table lists. Don't set text grey with a class of your own: through the component's part, a grey line means the same thing on every screen, and theraft-ui/no-muted-textlint rule reports a muted or hint text colour an app writes by hand (Using raft-ui). - Use the tier tokens for text, never an alpha variant such as
text-foreground-muted/70: the contrast guarantee holds only for the tiers. Alpha is for decorative glyphs, such as the separator in a message footer.
Notes on deeper surfaces
- How heavy a note looks depends on more than contrast. In a compact row, the closer a note is in size to the text it annotates, the further apart their colors must be.
- When a note sits on a card or popup that is deeper than the canvas, check it once by eye. If it reads heavy, move it half a tier lighter.
- Separate two levels of text by at most two of size, weight and color.
- Fix one case in place, with a class. Turn it into a shared token only after two or three similar cases. APCA (Lc), which accounts for polarity and size, is a better check than the WCAG ratio in dark mode when a case is in doubt.
Metric tokens
A field and a card title each have tokens for their type metrics, so that the parts laid out with them use the same values. Like the scale, each has a phone value and a desktop value, under the same query.
field-*sets the text of Input, Textarea, the field variant of SelectTrigger and the options of a Select list (utilitiestext-field,font-field). An option shares the field's type, so a value doesn't change size when the list opens; its height and padding stay its own, because a list row is not a control.- Never set field text below 16px on a phone: iOS zooms the page into a field whose text is smaller. A desktop has no such zoom, so field text follows the desktop body size there.
card-title-*sets CardTitle (utilitiestext-card-title,font-card-title). A radio or checkbox laid beside a card title uses its line height to line up with it.
Casing
-
Use one casing for all text: sentence case, with names keeping their capitals. Long labels such as menu items read awkwardly in Title Case, and one casing is simpler to write, translate and check (0044).
-
Never set text in all caps, in CSS or in the string. 0002 allows one exception, a step label on an onboarding screen; the product's setup writes its step label in sentence case, so nothing in the product is in all caps (Brand).
-
The rules for writing labels, and what counts as a name, are in Writing.
Related
- Writing: the words themselves.
- Tokens: every token group and how the names are built.
- Accessibility: why there are no all caps.
- Alignment: how text lines up with shapes and edges.