@sanity/ui 5.0.0-alpha.21 → 5.0.0-alpha.23

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.
Files changed (128) hide show
  1. package/README.md +10 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/styles.css +1 -1
  5. package/docs/components/avatar-counter.dsds.yaml +78 -0
  6. package/docs/components/avatar-stack.dsds.yaml +96 -0
  7. package/docs/components/avatar.dsds.yaml +115 -0
  8. package/docs/components/badge.dsds.yaml +126 -0
  9. package/docs/components/box.dsds.yaml +223 -0
  10. package/docs/components/button.dsds.yaml +284 -0
  11. package/docs/components/card.dsds.yaml +317 -0
  12. package/docs/components/checkbox.dsds.yaml +204 -0
  13. package/docs/components/code.dsds.yaml +167 -0
  14. package/docs/components/container.dsds.yaml +189 -0
  15. package/docs/components/dialog.dsds.yaml +343 -0
  16. package/docs/components/divider.dsds.yaml +93 -0
  17. package/docs/components/eyebrow.dsds.yaml +217 -0
  18. package/docs/components/flex.dsds.yaml +237 -0
  19. package/docs/components/grid.dsds.yaml +217 -0
  20. package/docs/components/h-stack.dsds.yaml +127 -0
  21. package/docs/components/heading.dsds.yaml +233 -0
  22. package/docs/components/hotkeys.dsds.yaml +60 -0
  23. package/docs/components/icon-button.dsds.yaml +220 -0
  24. package/docs/components/icon.dsds.yaml +275 -0
  25. package/docs/components/indicator-stack.dsds.yaml +98 -0
  26. package/docs/components/indicator.dsds.yaml +108 -0
  27. package/docs/components/inline.dsds.yaml +127 -0
  28. package/docs/components/kbd.dsds.yaml +59 -0
  29. package/docs/components/link.dsds.yaml +108 -0
  30. package/docs/components/list-button-item.dsds.yaml +103 -0
  31. package/docs/components/list-item-image.dsds.yaml +82 -0
  32. package/docs/components/list-item-text.dsds.yaml +80 -0
  33. package/docs/components/list-item.dsds.yaml +148 -0
  34. package/docs/components/list.dsds.yaml +162 -0
  35. package/docs/components/popover.dsds.yaml +208 -0
  36. package/docs/components/press-area.dsds.yaml +279 -0
  37. package/docs/components/radio.dsds.yaml +198 -0
  38. package/docs/components/select.dsds.yaml +214 -0
  39. package/docs/components/skip-to-content.dsds.yaml +110 -0
  40. package/docs/components/spinner.dsds.yaml +119 -0
  41. package/docs/components/switch.dsds.yaml +202 -0
  42. package/docs/components/tab.dsds.yaml +54 -0
  43. package/docs/components/tabs-list.dsds.yaml +56 -0
  44. package/docs/components/tabs-panel.dsds.yaml +54 -0
  45. package/docs/components/tabs.dsds.yaml +104 -0
  46. package/docs/components/text-area.dsds.yaml +170 -0
  47. package/docs/components/text-input.dsds.yaml +189 -0
  48. package/docs/components/text.dsds.yaml +268 -0
  49. package/docs/components/tooltip-group.dsds.yaml +90 -0
  50. package/docs/components/tooltip.dsds.yaml +216 -0
  51. package/docs/components/v-stack.dsds.yaml +155 -0
  52. package/docs/components/visually-hidden.dsds.yaml +112 -0
  53. package/docs/evals/cases.yaml +1319 -0
  54. package/docs/examples/checkbox-2.tsx +57 -0
  55. package/docs/examples/confirmation-dialogs-1.tsx +27 -0
  56. package/docs/examples/confirmation-dialogs-2.tsx +55 -0
  57. package/docs/examples/confirmation-dialogs-3.tsx +28 -0
  58. package/docs/examples/confirmation-dialogs-4.tsx +38 -0
  59. package/docs/examples/popover-1.tsx +48 -0
  60. package/docs/examples/popover-2.tsx +53 -0
  61. package/docs/foundations/accessibility-guidelines.dsds.yaml +301 -0
  62. package/docs/foundations/color-guidelines.dsds.yaml +308 -0
  63. package/docs/foundations/content-guidelines.dsds.yaml +285 -0
  64. package/docs/foundations/semantics.dsds.yaml +125 -0
  65. package/docs/foundations/spacing-guidelines.dsds.yaml +226 -0
  66. package/docs/foundations/typography-guidelines.dsds.yaml +322 -0
  67. package/docs/icons.dsds.yaml +2513 -0
  68. package/docs/index.dsds.yaml +515 -0
  69. package/docs/overview/api-essentials.dsds.yaml +221 -0
  70. package/docs/overview/component-reference.dsds.yaml +215 -0
  71. package/docs/overview/designer-contribution-model.dsds.yaml +77 -0
  72. package/docs/overview/developer-contribution-model.dsds.yaml +362 -0
  73. package/docs/overview/installation.dsds.yaml +238 -0
  74. package/docs/overview/quick-start.dsds.yaml +317 -0
  75. package/docs/overview/resources.dsds.yaml +34 -0
  76. package/docs/patterns/confirmation-dialogs.dsds.yaml +140 -0
  77. package/docs/patterns/error-messaging.dsds.yaml +58 -0
  78. package/docs/patterns/forms.dsds.yaml +356 -0
  79. package/docs/patterns/layouts.dsds.yaml +403 -0
  80. package/docs/patterns/loading-states.dsds.yaml +41 -0
  81. package/docs/patterns/messaging.dsds.yaml +72 -0
  82. package/docs/patterns/navigation.dsds.yaml +153 -0
  83. package/docs/patterns/responsive.dsds.yaml +590 -0
  84. package/docs/tokens/color.dsds.yaml +1158 -0
  85. package/docs/tokens/container-widths.dsds.yaml +131 -0
  86. package/docs/tokens/content.dsds.yaml +258 -0
  87. package/docs/tokens/content.tokens.json +180 -0
  88. package/docs/tokens/dtcg/README.md +39 -0
  89. package/docs/tokens/dtcg/css/color.css +107 -0
  90. package/docs/tokens/dtcg/css/container.css +12 -0
  91. package/docs/tokens/dtcg/css/fontFamily.css +10 -0
  92. package/docs/tokens/dtcg/css/fontWeight.css +10 -0
  93. package/docs/tokens/dtcg/css/index.css +13 -0
  94. package/docs/tokens/dtcg/css/radius.css +14 -0
  95. package/docs/tokens/dtcg/css/semantic.css +42 -0
  96. package/docs/tokens/dtcg/css/shadow.css +22 -0
  97. package/docs/tokens/dtcg/css/space.css +16 -0
  98. package/docs/tokens/dtcg/css/typography.css +69 -0
  99. package/docs/tokens/dtcg/json/color.tokens.json +911 -0
  100. package/docs/tokens/dtcg/json/container.tokens.json +44 -0
  101. package/docs/tokens/dtcg/json/fontFamily.tokens.json +10 -0
  102. package/docs/tokens/dtcg/json/fontWeight.tokens.json +18 -0
  103. package/docs/tokens/dtcg/json/radius.tokens.json +58 -0
  104. package/docs/tokens/dtcg/json/semantic.tokens.json +372 -0
  105. package/docs/tokens/dtcg/json/shadow.tokens.json +599 -0
  106. package/docs/tokens/dtcg/json/space.tokens.json +72 -0
  107. package/docs/tokens/dtcg/json/typography.tokens.json +354 -0
  108. package/docs/tokens/font-family.dsds.yaml +79 -0
  109. package/docs/tokens/font-weight.dsds.yaml +103 -0
  110. package/docs/tokens/radius.dsds.yaml +153 -0
  111. package/docs/tokens/semantic.dsds.yaml +397 -0
  112. package/docs/tokens/shadow.dsds.yaml +125 -0
  113. package/docs/tokens/space.dsds.yaml +185 -0
  114. package/docs/tokens/typography.dsds.yaml +316 -0
  115. package/llms.txt +108 -0
  116. package/package.json +6 -3
  117. package/skills/sanity-ui-5/SKILL.md +158 -0
  118. package/skills/sanity-ui-5/references/component-choice.md +37 -0
  119. package/skills/sanity-ui-5/references/components.md +145 -0
  120. package/skills/sanity-ui-5/references/forms-and-accessibility.md +189 -0
  121. package/skills/sanity-ui-5/references/migrating-from-v3.md +250 -0
  122. package/skills/sanity-ui-5/references/props-and-imports.md +169 -0
  123. package/skills/sanity-ui-5/references/setup.md +177 -0
  124. package/skills/sanity-ui-5/references/silent-failures.md +33 -0
  125. package/skills/sanity-ui-5/references/taste.md +53 -0
  126. package/skills/sanity-ui-5/references/tone-and-color.md +55 -0
  127. package/src/css/classes/system/shadow.css +45 -0
  128. package/src/version.ts +2 -2
@@ -0,0 +1,322 @@
1
+ kind: sanity.foundation
2
+ id: typography-guidelines
3
+ name: Typography guidelines
4
+ description: Rules and conventions for applying Sanity UI's type scale, components, hierarchy, and reading mechanics across product interfaces.
5
+ metadata:
6
+ tags:
7
+ - concept
8
+ - typography
9
+ - type scale
10
+ - hierarchy
11
+ - readability
12
+ - heading
13
+ - text
14
+ - label
15
+ - code
16
+ - weight
17
+ - alignment
18
+ - Heading
19
+ - Text
20
+ - Code
21
+ - FontWeight
22
+ - line height
23
+ - measure
24
+ status:
25
+ status: stable
26
+ sections:
27
+ - kind: guidelines
28
+ for: all
29
+ title: Principles
30
+ items:
31
+ - level: should
32
+ statement: Proportional. Hierarchy comes from the ratio between steps, not from raw pixel values. The scale sets the proportions. You choose a step; the rendered size follows.
33
+ - level: should
34
+ statement: Restrained. Most pages need three or four roles, not eight. Fewer sizes and fewer weights make hierarchy clearer. Reach for weight and space before adding a new size.
35
+ - level: should
36
+ statement: Meaning before look. A heading's level marks structure; its size sets appearance. Keep the two apart, and the outline stays correct at any size.
37
+ - level: should
38
+ statement: Conventional. Start alignment, sentence case, and a small weight set follow patterns readers already know. Vary only with a clear reason.
39
+ - kind: guidelines
40
+ for: all
41
+ framing: how-to-use
42
+ items:
43
+ - refs:
44
+ - to: semantics#heading-level-from-outline
45
+ rel: same-as
46
+ - refs:
47
+ - to: semantics#heading-levels-sequential
48
+ rel: same-as
49
+ - level: should
50
+ statement: Build hierarchy with size and weight before adding color. Design the ranking in grayscale first, then add color as reinforcement.
51
+ - level: should-not
52
+ statement: Don't use all-caps for body text or long strings. It harms legibility and breaks rhythm.
53
+ - level: should-not
54
+ statement: Don't center body copy. It removes the consistent return edge the eye depends on.
55
+ - id: no-truncate-body-copy
56
+ level: must-not
57
+ statement: Don't truncate paragraph text. Clipping changes meaning. Reserve `truncate` for metadata and support labels.
58
+ checks:
59
+ - href: ../evals/cases.yaml
60
+ role: agent-test
61
+ checkedBy: assisted
62
+ $extensions:
63
+ io.jev:
64
+ type: boolean
65
+ - level: must-not
66
+ statement: Don't use icons in place of text for complex or critical content. An icon with no text equivalent is invisible to screen readers.
67
+ - id: don-emoji-text-screen-readers
68
+ level: must-not
69
+ statement: Don't use emoji in UI text. Screen readers announce emoji descriptions verbatim, which breaks reading flow. Emoji also render differently across platforms and break typographic consistency.
70
+ - kind: guidelines
71
+ for: all
72
+ title: Applying type in practice
73
+ items:
74
+ - level: should
75
+ statement: 'Focus on visual and semantic hierarchy: use size, weight, and lightness to direct attention effectively, so the structure helps people understand what to focus on.'
76
+ - level: should-not
77
+ statement: 'Let the content speak for itself: avoid type treatments such as accent colors, extreme sizes, dead-center alignment, or all caps to drive engagement or attention.'
78
+ - level: should-not
79
+ statement: 'Truncation is not a substitute for concise writing: truncating text harms comprehension, and succinct copywriting is always a better solution than hiding text.'
80
+ - kind: guidelines
81
+ for: agent
82
+ framing: how-to-use
83
+ items:
84
+ - level: must-not
85
+ statement: Never add letter spacing to lowercase text; it breaks word recognition.
86
+ - kind: section
87
+ for: all
88
+ freeform:
89
+ - title: Overview
90
+ body: |-
91
+ Type does two jobs at once. It carries words, and it ranks them before anyone reads. The typography system gives designers and developers a shared scale and a set of components for building ordered interfaces.
92
+ - kind: section
93
+ for: all
94
+ freeform:
95
+ - title: Fundamentals
96
+ body: |-
97
+ These describe how reading works. The rules in this document follow from them.
98
+
99
+ **Letters are recognized, not word shapes.** Legibility and readability solve different problems. Legibility asks if letters are distinct. Readability asks if the text flows.
100
+
101
+ **The eye jumps and pauses.** Reading moves in saccades (jumps) and fixations (pauses), with a return sweep at each line end. Erratic spacing or a missing left edge breaks that rhythm and slows reading.
102
+
103
+ **Measure governs readability.** Line length controls whether the eye finds the next line. Long lines lose the return sweep. Short lines break rhythm. The workable range spans roughly 45–75 characters.
104
+
105
+ **Vertical rhythm aids scanning.** Even line spacing makes a text block feel like a system. It gives the eye a steady cadence.
106
+
107
+ **Type ranks content before it is read.** Size, weight, and spacing assign rank at a glance. Hierarchy is the first thing type conveys.
108
+
109
+ **Hierarchy lives in lightness, not hue.** Size, weight, and space rank content for every viewer. Hierarchy built on color alone fails in grayscale and for people with low vision.
110
+ - kind: section
111
+ for: all
112
+ freeform:
113
+ - title: Components
114
+ body: |-
115
+ **Heading** renders `h1`–`h6` elements. Use it for page titles, section headings, and inspector headers. Always set the heading level with `as`.
116
+
117
+ **Text** renders inline elements. Use it for body copy, captions, labels, and all support text.
118
+
119
+ **Form labels** use `Text` with `as="label"`, which renders as a native `<label>`. Use it for the label in a form field.
120
+
121
+ **Code** renders inline or block code. Use it for code samples, identifiers, and inline tokens. `Code` does not accept an `align` prop — it inherits block flow.
122
+ - title: Choosing between Heading and Text
123
+ body: |-
124
+ - Use `Heading` when the text names a section of the page outline.
125
+ - Use `Text` for body copy and for UI text that is not a heading.
126
+ - Use `Text` with `as="label"` for the visible name of a TextInput, Select or other input.
127
+ - A dense panel text element that does not belong in the outline is `Text 1`, not `Heading 0`.
128
+ - kind: section
129
+ for: all
130
+ freeform:
131
+ - title: Typefaces
132
+ body: |-
133
+ **Inter** is the primary typeface. All content, UI controls, and inputs use it. Sanity UI enables these font features:
134
+
135
+ | Feature | Code | Purpose |
136
+ | --- | --- | --- |
137
+ | Disambiguation | `ss02` | Renders 0, I, l, and ß in distinct alternate forms. |
138
+ | Discretionary ligatures | `dlig` | Joins common letter pairs (ff, fi, ft, tt, and others) for smoother reading. |
139
+ | Tabular numbers | `tnum` | Fixed-width numerals. Use only inside tables. |
140
+
141
+ **Code** uses the operating system's default monospace:
142
+
143
+ | OS | Typeface |
144
+ | --- | --- |
145
+ | macOS | SF Mono |
146
+ | Windows | Consolas / Courier New |
147
+ | Ubuntu / GNOME | Ubuntu Mono |
148
+ | Fedora / Debian | DejaVu Sans Mono |
149
+ - kind: section
150
+ for: all
151
+ freeform:
152
+ - title: Type hierarchy
153
+ body: |-
154
+ Map each role to a component, size, and weight. Most pages use three or four of these. The table is the available set, not a checklist — fewer roles means clearer hierarchy.
155
+
156
+ | Role | Component | Size | Weight |
157
+ | --- | --- | --- | --- |
158
+ | Page title | `Heading` | `3` | bold |
159
+ | Section title | `Heading` | `2` | bold |
160
+ | Sidebar / inspector title | `Heading` | `1` | semibold |
161
+ | Dense panel title | `Heading` | `0` | semibold |
162
+ | Categorize or contextualize a title | `Eyebrow` | Size relative to Heading | semibold |
163
+ | Body copy | `Text` | `2` | regular |
164
+ | UI text elements (buttons, menus, tabs) | `Text` | `1` | medium |
165
+ | Captions, metadata | `Text` | `0` | medium |
166
+ | Form labels | `Text` with `as="label"` | `1` | none |
167
+
168
+ Form labels set with `Text` use `size={1}`, which renders at {body-1}.
169
+
170
+ Captions and metadata use `Text 0`. Reach for `Text 1` only when the caption sits next to body copy and must hold its own.
171
+ - kind: section
172
+ for: all
173
+ freeform:
174
+ - title: Scale
175
+ body: The scale is a set of proportions, not hand-set sizes. Choose a step; the rendered size and line height come from its token. The default theme exposes no single clean modular ratio across the steps. Design with the steps, not one multiplier.
176
+ - title: Heading scale
177
+ body: |-
178
+ Sizes `0` through `5`. Each size's line height comes with its token.
179
+
180
+ | Size | Token | Common use |
181
+ | --- | --- | --- |
182
+ | `0` | {heading-0} | UI chrome — toolbars, sidebars, dense panels |
183
+ | `1` | {heading-1} | Sub-section titles |
184
+ | `2` **(default)** | {heading-2} | Standard section headings |
185
+ | `3` | {heading-3} | Document titles in high-density layouts |
186
+ | `4` | {heading-4} | Document titles in medium-density layouts |
187
+ | `5` | {heading-5} | Document titles in low-density layouts |
188
+ - title: Text scale
189
+ body: |-
190
+ Sizes `0` through `4`. Sizes `3` and `4` serve display purposes only — hero and empty-state text, not product chrome. Each size's line height comes with its token.
191
+
192
+ | Size | Token | Common use |
193
+ | --- | --- | --- |
194
+ | `0` | {body-0} | Fine print, metadata |
195
+ | `1` | {body-1} | UI labels, buttons, menu items, tabs |
196
+ | `2` **(default)** | {body-2} | Body copy |
197
+ | `3` | {body-3} | Display body — intros and lead paragraphs |
198
+ | `4` | {body-4} | Display body — hero and empty-state text |
199
+ - title: Eyebrow and Code scale
200
+ body: '`Code` runs sizes `0` through `4`, defaulting to `2`: {code-0}, {code-1}, {code-2}, {code-3} and {code-4}. `Eyebrow` runs sizes `0` through `4`: {label-0}, {label-1}, {label-2}, {label-3} and {label-4}.'
201
+ - kind: section
202
+ for: all
203
+ freeform:
204
+ - title: Measure
205
+ body: 'Constrain body text to roughly 45–75 characters per line. Start with `max-inline-size: 66ch`. The `ch` unit approximates character count from the `0` glyph width, so treat 66ch as a target. Check that the rendered line lands in the 45–75 range, above all for `Code` or when the font changes. Outside this range, the return sweep fails and reading slows. Measure delivers more readability gain than any other single factor.'
206
+ - title: Line height
207
+ body: |-
208
+ Body text needs ample line height: 1.5×. This also gives the layout headroom for the WCAG 1.4.12 text-spacing override, where users force 1.5× line height (see Accessibility). Headings and eyebrows use a tighter 1.25× at every size. Longer lines need more leading.
209
+
210
+ | Tokens | Components | Line height |
211
+ | --- | --- | --- |
212
+ | `body-0`–`body-4` | `Text` 0–4 | 1.5× |
213
+ | `code-0`–`code-4` | `Code` 0–4 | 1.5× |
214
+ | `heading-0`–`heading-5` | `Heading` 0–5 | 1.25× |
215
+ | `label-0`–`label-4` | `Eyebrow` 0–4 | 1.25× |
216
+
217
+ The values come from `tokens/dtcg/json/typography.tokens.json`.
218
+ - title: Alignment
219
+ body: |-
220
+ Start-align body text by default. Left-aligned text in left-to-right scripts gives the eye a consistent return edge and supports readers with dyslexia.
221
+
222
+ Center alignment works for short, standalone strings — empty-state headings and modal titles. Center body copy never.
223
+
224
+ End alignment suits numeric content. Numerals align on the right edge, so columns of figures compare at a glance. Use it for numbers in tables.
225
+
226
+ Justified text creates uneven word spacing. It breaks the consistent return edge the eye depends on. Avoid it in interfaces.
227
+
228
+ Alignment applies to `Heading`, `Text`, and `Eyebrow`. `Code` has no `align` prop.
229
+ - kind: section
230
+ for: all
231
+ freeform:
232
+ - title: Weight
233
+ body: |-
234
+ Weight creates emphasis. Many weights at one level cancel the effect. `FontWeight` holds four values. What each weight is for is in the Font weight entry's table (`font-weight`).
235
+
236
+ - kind: section
237
+ for: all
238
+ freeform:
239
+ - title: Typographic conventions
240
+ body: |-
241
+ Typography owns how letters and numerals are rendered — small caps, figure style, letter spacing, line breaks. The Content guidelines own which words, casing, and numerals get written. When both touch a string, content decides the characters; typography decides the look.
242
+
243
+ **Acronyms and abbreviations.** Whether to use an acronym, and how to capitalize it, is a content decision. The Content guidelines keep short forms like CSV, JSON, and URL in their own casing. For rendering: the default Sanity UI type stack does not expose small caps. Set acronyms in full uppercase with a little letter spacing, which keeps the rhythm. A font with small-cap OpenType features reads better in spaced small caps. Confirm support with the frontend team first.
244
+
245
+ **Figures.** Use lining figures (titling numerals) everywhere by default. The Sanity UI default stack does not ship oldstyle figures. If the active font exposes oldstyle (text) figures, use them in body copy. Keep lining figures for tables and all-caps strings, where column alignment matters. This rule is about numeral style. Whether to write a numeral or spell a number out is a content decision. The Content guidelines call for figures over words in counts ("Delete 3 items").
246
+
247
+ **Letter spacing.** Add a little letter spacing to the all-caps strings and acronyms that remain. Use them with restraint — see the Don'ts below and the Content guidelines. Add letter spacing to lowercase text never. It breaks word recognition.
248
+
249
+ **Numbers and units.** Join a number and its unit with a non-breaking space (`&nbsp;`). This stops the value and unit from splitting across lines: `10 MB`, not `10<br>MB`. This matches the Content guidelines' file-size example ("Try a file under 10 MB").
250
+
251
+ Sentence-level format — sentence case, one space between sentences, the Oxford comma — lives in the Content guidelines. This doc defers to it for casing.
252
+ - kind: section
253
+ for: all
254
+ freeform:
255
+ - title: Vertical rhythm and the trim prop
256
+ body: |-
257
+ A line of text carries space above and below its glyphs that the glyphs themselves don't use — the font's built-in ascender and descender space. That space is what makes multi-line text comfortable to read, but it also makes a text component's box taller than what the eye reads as "the text." Compare that against padding, a `gap`, or a border, and the visible space ends up larger than the spacing scale value says — a `gap` of `3` ({space-3}) next to an untrimmed `Heading` can read closer to {space-4} once the font's leading is added on top.
258
+
259
+ `trim` removes that mismatch. Set `trim` on `Heading`, `Text`, `Eyebrow`, or `Code` to collapse the invisible leading above and below the text, so the rendered box hugs the visible glyphs instead of the font's full line-height. The correction is sized per step — larger sizes carry more leading, so they get a larger adjustment:
260
+
261
+ | Component | Size | Trim adjustment |
262
+ | :---- | :---- | :---- |
263
+ | `Heading` | `0` | −4px |
264
+ | `Heading` | `1` | −5px |
265
+ | `Heading` | `2` | −6px |
266
+ | `Heading` | `3` | −7px |
267
+ | `Heading` | `4` | −8px |
268
+ | `Heading` | `5` | −10px |
269
+ | `Text` / `Code` | `0` | −4px |
270
+ | `Text` / `Code` | `1` | −5px |
271
+ | `Text` / `Code` | `2` | −6px |
272
+ | `Text` / `Code` | `3` | −7px |
273
+ | `Text` / `Code` | `4` | −8px |
274
+ | `Eyebrow` | `0` | −2px |
275
+ | `Eyebrow` | `1` | −2.5px |
276
+ | `Eyebrow` | `2` | −3px |
277
+ | `Eyebrow` | `3` | −3.5px |
278
+ | `Eyebrow` | `4` | −4px |
279
+ | `Eyebrow` | `5` | −4.5px |
280
+
281
+ `Eyebrow` trim values were added in 5.0.0-alpha.20.
282
+
283
+ `trim` defaults to off. Turn it on deliberately, not as a habit.
284
+
285
+ **When to use it.** Reach for `trim` whenever a text element's spacing needs to line up exactly with something else: a `Heading` or `Text` sitting directly against a Card's padding, a short title or label next to an icon or avatar sharing a baseline or center line, or any place a `gap` value from the spacing scale needs to be the true visual distance to a neighbor.
286
+
287
+ **When not to use it.** Leave `trim` off for running text — paragraphs, multi-line body copy, anything meant to read normally. The leading `trim` removes is the same leading that keeps multi-line text comfortable. Default to no `trim`, and reach for it only when a specific alignment problem shows up. See Spacing → Vertical rhythm for how this interacts with the spacing scale.
288
+
289
+ **Trim and truncate together.** Setting both `trim` and `truncate` on the same `Heading`, `Text`, or `Eyebrow` works, but the component changes shape to do it — the truncation logic moves to an inner wrapping element, while the outer element carries the trim adjustment. Expect an additional wrapping element in the rendered DOM when both props are set together that isn't there when only one is.
290
+ - title: Truncation
291
+ body: '`Heading`, `Text`, and `Eyebrow` accept a `truncate` prop that limits text to a set line count. `truncate={1}` clips to one line with an ellipsis; higher values clamp to that many lines. Use it for metadata and support labels. Use it as a last resort — succinct copy is always better than hidden text. Never apply it to critical actions or nav items.'
292
+ - kind: section
293
+ for: all
294
+ freeform:
295
+ - title: Related
296
+ body: |-
297
+ - **Content guidelines** — casing, acronym use, numerals as words vs. figures, sentence-level format.
298
+ - **Color guidelines** — contrast, grayscale hierarchy, semantic tone.
299
+ - **Spacing guidelines** — the spacing scale and vertical rhythm.
300
+ - **Accessibility** — resize, reflow, text-spacing overrides, contrast, full code.
301
+ - kind: section
302
+ for: all
303
+ freeform:
304
+ - title: Checklist
305
+ body: |-
306
+ Before finalizing any text treatment:
307
+
308
+ - [ ] Every size comes from the scale?
309
+ - [ ] Hierarchy uses the fewest sizes, leaning on weight and space first?
310
+ - [ ] Body measure within 45–75 characters?
311
+ - [ ] Line height set for this size and measure, aligned to the spacing rhythm?
312
+ - [ ] Body copy start-aligned?
313
+ - [ ] Heading levels match the page outline, not the visual size?
314
+ - [ ] Acronyms checked against the Content guidelines, then rendered in uppercase or letter-spaced?
315
+ - [ ] Hierarchy holds in grayscale?
316
+ - [ ] Every text/background pair meets WCAG 2.2 AA contrast, in light and dark (see the Accessibility guidelines)?
317
+ - [ ] Text resizes to 200% and reflows to 320px (see Accessibility)?
318
+ - kind: section
319
+ for: agent
320
+ freeform:
321
+ - title: Intent
322
+ body: Use this guide to apply Sanity UI's type scale and components correctly, enforce heading structure, and uphold readability and accessibility conventions in any interface that renders text.