@fusion.dev/helix-docs 0.236.0 → 0.237.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,15 +18,59 @@ title: Typography
18
18
 
19
19
  [//]: # (/tokens)
20
20
 
21
- Helix has three font families and no scale of weights and widths. A design
22
- system with more families than a product uses ends up with two that mean the
21
+ Helix has three font families, three weights, and no widths. A design system
22
+ with more families or weights than a product uses ends up with two that mean the
23
23
  same thing.
24
24
 
25
25
  ## The type scale
26
26
 
27
27
  The type scale runs from `--helix-text-xs` to `--helix-text-3xl`.
28
28
  `--helix-text-control` sets the size of a control's own text. It follows the
29
- region's density and is separate from the type scale.
29
+ region's density and is separate from the type scale. A field you type into
30
+ takes two more that follow density:
31
+
32
+ - `--helix-text-field` is the value you type: 13px at `sm`, and 14px at `md`
33
+ and `lg`.
34
+ - `--helix-text-field-label` is the field's label, a step under its value: 12px
35
+ at `sm`, and 13px at `md` and `lg`.
36
+
37
+ | Token | Size |
38
+ | --- | --- |
39
+ | `--helix-text-xs` | 12px |
40
+ | `--helix-text-sm` | 13px |
41
+ | `--helix-text-md` | 14px |
42
+ | `--helix-text-lg` | 18px |
43
+ | `--helix-text-xl` | 24px |
44
+ | `--helix-text-2xl` | 32px |
45
+ | `--helix-text-3xl` | 42px |
46
+
47
+ A ramp sets the size, weight, leading, and letter spacing of text together.
48
+ `[data-text]` and the `scale` property of `Text` take the same nine ramps:
49
+
50
+ | Ramp | Size | Weight |
51
+ | --- | --- | --- |
52
+ | `display` | 42px | 600, in the display face |
53
+ | `heading` | 32px | 600 |
54
+ | `subheading` | 24px | 600 |
55
+ | `title` | 18px | 600 |
56
+ | `body` | 14px | 400 |
57
+ | `body-strong` | 14px | 500 |
58
+ | `caption` | 13px | 400 |
59
+ | `label` | 12px | 500 |
60
+ | `code` | 13px | 400, in the mono face |
61
+
62
+ `Text` maps each heading level onto a ramp, and so do the headings inside
63
+ `[data-prose]`:
64
+
65
+ | Element | Ramp |
66
+ | --- | --- |
67
+ | `h1` | `display` |
68
+ | `h2` | `heading` |
69
+ | `h3` | `subheading` |
70
+ | `h4` | `title` |
71
+ | `h5` and `h6` | `body-strong` |
72
+
73
+ Set `scale` to choose a ramp yourself.
30
74
 
31
75
  **On a touch screen, text you type is at least 16px.** iOS Safari zooms the
32
76
  page into a focused input, textarea, or select whose text is smaller than
@@ -86,12 +130,45 @@ right. There is no separate `Heading` component, because `as` does that job.
86
130
  ```
87
131
 
88
132
  Put `[data-prose]` on the element that contains your text. Inside it, the token
89
- layer styles headings, paragraphs, lists, links, and code.
133
+ layer does the following:
134
+
135
+ - It sets the size, weight, and leading of each heading.
136
+ - It ends each paragraph, list, quote, table, and block of code with one gap,
137
+ `--helix-space-sm`.
138
+ - It styles links and code.
139
+
140
+ **A heading takes no space of its own.** The space above a heading is the gap
141
+ after the block before it, and the block after it starts on the next line. Set
142
+ the space around headings in your own stylesheet:
143
+
144
+ ```css
145
+ :where([data-prose] :is(h2, h3)) {
146
+ margin-block: var(--helix-space-xl) var(--helix-space-sm);
147
+ }
148
+ ```
149
+
150
+ **Set a document for reading with `data-prose="reading"`.** The default size
151
+ is 14px, which suits a reply in a chat bubble or a note in a panel. A
152
+ documentation page or an article reads better larger:
153
+
154
+ ```html
155
+ <article data-prose="reading">
156
+ <h2>Install the connector</h2>
157
+ <p>Text at 18px on a 27px line, about 70 characters wide.</p>
158
+ </article>
159
+ ```
160
+
161
+ `reading` makes the following changes:
162
+
163
+ - It sets the text at `--helix-text-lg`, on `--helix-leading-normal`.
164
+ - It ends each block with `--helix-space-md`.
165
+ - It stops paragraphs, lists, and quotes at 34em.
166
+ - It sets a table at 16px, between `md` and `lg`.
90
167
 
91
168
  For one-off text outside prose, use `[data-text]` to set the ramp:
92
169
 
93
170
  ```html
94
- <span data-text="sm">Fine print</span>
171
+ <span data-text="caption">Fine print</span>
95
172
  ```
96
173
 
97
174
  ## Line height, letter spacing, and weight
@@ -101,9 +178,10 @@ For one-off text outside prose, use `[data-text]` to set the ramp:
101
178
  | Token | Value | For |
102
179
  | --- | --- | --- |
103
180
  | `--helix-leading-tight` | `1.2` | Body text set close, for short lines. |
181
+ | `--helix-leading-snug` | `1.4` | One line of small type on a plate, such as a chart label. |
104
182
  | `--helix-leading-normal` | `1.5` | Body text. The default line height for a paragraph. |
105
183
  | `--helix-leading-loose` | `1.7` | Body text set open, for long lines or small sizes. |
106
- | `--helix-leading-heading` | `calc(0.99em + 0.5rem)` | Headings, which need less line height than a paragraph. It is a length plus an em, so it tightens as the type grows. |
184
+ | `--helix-leading-heading` | `round(up, calc(0.99em + 0.5rem), 1px)` | Headings, which need less line height than a paragraph. It is a length plus an em, so it tightens as the type grows. |
107
185
 
108
186
  [//]: # (/tokens)
109
187
 
@@ -128,6 +206,10 @@ For one-off text outside prose, use `[data-text]` to set the ramp:
128
206
 
129
207
  [//]: # (/tokens)
130
208
 
209
+ Most text takes `tight`, `normal`, or `loose`. `--helix-leading-snug` is for
210
+ one line of small type on a plate of its own, such as a Donut Chart's slice
211
+ label, a Sparkline's reading, or a count in a Log line.
212
+
131
213
  **Headings have their own leading token.** At a paragraph's line height, a
132
214
  heading looks loose at every size. The fix is not proportional, because larger
133
215
  type needs less leading. `--helix-leading-heading` expresses that once, so no
@@ -232,7 +232,7 @@ smeared, and a filter behind an opaque ground cannot be seen. With no
232
232
  | Value | What it draws |
233
233
  |---|---|
234
234
  | `glass` | A translucent ground and the backdrop filter that makes it read |
235
- | `frosted` | The same pair turned up, a heavier ground under a heavier blur. A Dialog or Drawer's `glass` is already as heavy in light, so there the two differ by blur alone |
235
+ | `frosted` | A heavier ground under a heavier blur with no added saturation: 88% of the ground under a 32px blur, against glass's 72% in light under 16px. Every family draws `glass` at one coverage, a Dialog and a Drawer included, so `frosted` is heavier on all of them |
236
236
  | `transparent` | Neither, so the page shows through structure and spacing |
237
237
 
238
238
  Use `frosted` for a surface that has to stay readable over a busy page. A theme