Typography
A Typography object holds individual text style properties. It appears on the typography style property as an alternative to a TokenReference — when the text style is not backed by a single token, the individual properties are listed instead.
interface Typography { fontSize?: number | 'mixed' | TokenReference; fontFamily?: string | 'mixed' | TokenReference; fontStyle?: string | 'mixed' | TokenReference; lineHeight?: string | number | TokenReference; letterSpacing?: number | 'mixed' | TokenReference; textCase?: string | 'mixed' | TokenReference; textDecoration?: string | 'mixed' | TokenReference; paragraphIndent?: number | TokenReference; paragraphSpacing?: number | TokenReference; leadingTrim?: 'NONE' | 'CAP_HEIGHT' | 'mixed'; listSpacing?: number | TokenReference; hangingPunctuation?: boolean | TokenReference; hangingList?: boolean | TokenReference;}Properties
| Name | Default |
|---|---|
fontFamily | null |
fontSize | 16 |
fontStyle | null |
hangingList | false |
hangingPunctuation | false |
leadingTrim | "NONE" |
letterSpacing | 0 |
lineHeight | "AUTO" |
listSpacing | 0 |
paragraphIndent | 0 |
paragraphSpacing | 0 |
textCase | "ORIGINAL" |
textDecoration | "NONE" |
Values
| Name | Description | Example |
|---|---|---|
number | Literal numeric value | 16 |
string | Literal string value | "Inter" |
boolean | Literal boolean value | true |
'mixed' | Multiple conflicting values within a single text node | "mixed" |
TokenReference | Reference to a design token | { $token: "DS.Font.Size.400", $type: "dimension" } |
'NONE' | 'CAP_HEIGHT' | Leading trim enum (for leadingTrim only) | "CAP_HEIGHT" |
Example
fontSize: 14fontFamily: InterfontStyle: MediumlineHeight: "150%"letterSpacing: 0Further Reading
- ADR 005 — Replace Typography Flat Properties with Composite — consolidates 14 flat typography keys into a single composite type
- ADR 032 — Typography leadingTrim — Correct to String Enum — fixes
leadingTrimto a string enum - ADR 033 — Typography fontFamily/fontStyle — Remove Number, Add TokenReference — adds token reference support to font properties