@sanity/ui 5.0.0-alpha.22 → 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 (127) 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 +5 -2
  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/version.ts +2 -2
@@ -0,0 +1,308 @@
1
+ kind: sanity.foundation
2
+ id: color-guidelines
3
+ name: Color guidelines
4
+ description: Explains Sanity UI's color principles, token layers, semantic tone system, interaction states, and practical rules for applying color in interface design.
5
+ metadata:
6
+ tags:
7
+ - concept
8
+ - color
9
+ - tokens
10
+ - semantic
11
+ - accessibility
12
+ - theming
13
+ - contrast
14
+ - tones
15
+ - design-foundations
16
+ - semantic-tokens
17
+ - base-palette
18
+ - emphasis
19
+ - intensity
20
+ - interaction-states
21
+ - error
22
+ - critical
23
+ - inert
24
+ - active
25
+ status:
26
+ status: stable
27
+ sections:
28
+ - kind: guidelines
29
+ for: all
30
+ framing: how-to-use
31
+ items:
32
+ - level: must
33
+ statement: Design works in grayscale first — hierarchy is established before adding hue.
34
+ - id: second-channel-required
35
+ level: must
36
+ statement: 'Every color signal is backed by a second channel: text, icon, shape, or position.'
37
+ - level: must
38
+ statement: Components use semantic tokens.
39
+ - level: must
40
+ statement: Theming touches only the semantic layer.
41
+ - refs:
42
+ - to: accessibility-guidelines#contrast-minimums
43
+ rel: same-as
44
+ - refs:
45
+ - to: shared-foundations#destructive-actions-use-critical-tone
46
+ rel: same-as
47
+ - level: should
48
+ statement: The palette is as small as the job allows.
49
+ - kind: guidelines
50
+ for: agent
51
+ framing: how-to-use
52
+ items:
53
+ - level: must
54
+ statement: Use semantic tokens when composing UI.
55
+ - level: must
56
+ statement: 'Read a theme-aware color from a semantic CSS custom property when no component prop reaches it. On a native `<td>`, write `border: 1px solid var(--separator-low)`. Each property resolves for both schemes on its own.'
57
+ - level: must
58
+ statement: "Set the standard CSS `color-scheme` property to force light or dark. Write `:root { color-scheme: dark }`. Sanity UI 5 has no theme provider and no `scheme` prop. The stylesheet ships `color-scheme: light dark`. An app follows the reader's system setting until you override it."
59
+ - level: should
60
+ statement: Prefer a `tone` prop over a CSS custom property when one exists. Tone remaps the same variables across the whole subtree. The surface, its text and its separators then stay in step.
61
+ - level: must-not
62
+ statement: 'Do not use `--card-bg-color`, `--card-border-color` or `--card-fg-color`. These variables do not exist. They resolve to nothing. A fallback like `var(--card-bg-color, #fff)` then pins the color to the light value in both schemes.'
63
+ - level: must-not
64
+ statement: Do not hard-code a hex value for a surface, separator or text color. Do not use a base token such as `--gray-100` either. Base tokens hold one fixed color and ignore the scheme.
65
+ - level: must-not
66
+ statement: Do not use color as the only differentiator for states such as error, success, or selection.
67
+ - level: must-not
68
+ statement: Do not use hue alone to create contrast — hue does not reliably separate elements; use intensity (lightness/saturation) differences instead.
69
+ - kind: section
70
+ for: all
71
+ freeform:
72
+ - title: Overview
73
+ body: Color is powerful, but unreliable. Sanity UI's color system gives designers and developers a simple framework for applying color.
74
+ - kind: section
75
+ for: all
76
+ freeform:
77
+ - title: Principles
78
+ body: These are Sanity UI's stances on applying color.
79
+ - title: Purposeful
80
+ body: Color in Sanity UI is functional. It supports semantic meaning, visual contrast, and hierarchy. Arbitrary color choices are problematic choices.
81
+ - title: Supportive
82
+ body: Color only reinforces meaning. Using only color leaves people with low vision behind.
83
+ - title: Simple, with fallbacks
84
+ body: Sanity UI's semantic color set covers common use cases. But edge cases always exist. Teams should pull from the full Base palette in those cases.
85
+ - kind: section
86
+ for: all
87
+ freeform:
88
+ - title: Fundamentals
89
+ body: |-
90
+ - **Color is relative:** Color looks different based on color pairing, display, ambient light, viewing angle, and an individual's vision. A gray reads dark on white and light on black. You never see a color alone — only in its context.
91
+ - **The eye adapts to the dominant color:** The eye rebalances a color cast toward neutral after a few seconds. Small punches of color in a neutral environment separate better than larger ambient tone shifts.
92
+ - **Hue doesn't create reliable separation:** The eye reads text, edges, and shape from differences in intensity (lightness/saturation). Hue resolves far less detail. Hue alone won't create contrast.
93
+ - **Hue categorizes, intensity prioritizes:** The eye reads hue as a way to group items. Intensity draws attention — and thus importance. Use hue to classify and intensity to assign significance.
94
+ - **Contrast sensitivity falls at small sizes and in low light:** Thin strokes, small text, and fine icons need more contrast than large shapes to stay legible. A tint that works for a heading can fail for a caption or a 1px border.
95
+ - **Many people cannot separate certain hues:** Color vision deficiency is common — about 1 in 12 men. A color pairing that reads for most people can collapse for them, and a hue-only signal disappears.
96
+ - **Color meaning isn't innate:** People learn color meaning from culture and context. No meaning is universal — red warns in one place and rewards in another. This makes color expressive — but also volatile.
97
+ - kind: section
98
+ for: all
99
+ freeform:
100
+ - title: Base
101
+ body: Raw color values with no meaning. The full palette lives here — every option, indexed by brightness (low, mid, high). Base colors have no inherent meaning or purpose.
102
+ - title: Semantic
103
+ body: Where colors map to meaning. This is where designers and developers reach when composing a UI. Five tones, plus `active`, `brand`, and `accent`. Each carries a specific job.
104
+ - title: Component
105
+ body: Colors applied to component parts. Rarely used directly — most components inherit from the semantic layer. Only use to customize specific component color treatments.
106
+ - kind: section
107
+ for: all
108
+ freeform:
109
+ - title: Base color tokens
110
+ body: |-
111
+ | Color | 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950 |
112
+ | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- | :---- |
113
+ | Gray | {gray-50} | {gray-100} | {gray-200} | {gray-300} | {gray-400} | {gray-500} | {gray-600} | {gray-700} | {gray-800} | {gray-900} | {gray-950} |
114
+ | Blue | {blue-50} | {blue-100} | {blue-200} | {blue-300} | {blue-400} | {blue-500} | {blue-600} | {blue-700} | {blue-800} | {blue-900} | {blue-950} |
115
+ | Purple | {purple-50} | {purple-100} | {purple-200} | {purple-300} | {purple-400} | {purple-500} | {purple-600} | {purple-700} | {purple-800} | {purple-900} | {purple-950} |
116
+ | Magenta | {magenta-50} | {magenta-100} | {magenta-200} | {magenta-300} | {magenta-400} | {magenta-500} | {magenta-600} | {magenta-700} | {magenta-800} | {magenta-900} | {magenta-950} |
117
+ | Red | {red-50} | {red-100} | {red-200} | {red-300} | {red-400} | {red-500} | {red-600} | {red-700} | {red-800} | {red-900} | {red-950} |
118
+ | Orange | {orange-50} | {orange-100} | {orange-200} | {orange-300} | {orange-400} | {orange-500} | {orange-600} | {orange-700} | {orange-800} | {orange-900} | {orange-950} |
119
+ | Yellow | {yellow-50} | {yellow-100} | {yellow-200} | {yellow-300} | {yellow-400} | {yellow-500} | {yellow-600} | {yellow-700} | {yellow-800} | {yellow-900} | {yellow-950} |
120
+ | Green | {green-50} | {green-100} | {green-200} | {green-300} | {green-400} | {green-500} | {green-600} | {green-700} | {green-800} | {green-900} | {green-950} |
121
+ | Cyan | {cyan-50} | {cyan-100} | {cyan-200} | {cyan-300} | {cyan-400} | {cyan-500} | {cyan-600} | {cyan-700} | {cyan-800} | {cyan-900} | {cyan-950} |
122
+
123
+ The palette also has {black} and {white}. The values come from `tokens/dtcg/json/color.tokens.json`.
124
+ - kind: section
125
+ for: all
126
+ freeform:
127
+ - title: Tones
128
+ body: |-
129
+ Tones are the heart of the semantic layer. They convey intent.
130
+
131
+ Tones follow a three-layer structure: Tone type → Emphasis → Intensity
132
+
133
+ **Tone types:**
134
+
135
+ | Tone | When to use | Color |
136
+ | :---- | :---- | :---- |
137
+ | `neutral` | Default. No special state or meaning. | gray |
138
+ | `suggest` | Educational moments, promotions, soft nudges. | purple |
139
+ | `positive` | Success, correctness, completion. | green |
140
+ | `caution` | Non-critical failure, impending issue, incompleteness. | yellow |
141
+ | `critical` | Failure, destructive operations, termination. | red |
142
+ - title: Emphasis
143
+ body: |-
144
+ Emphasis sets the visual weight for an element.
145
+
146
+ **Normal:** The default emphasis level. Backgrounds have subtle contrast with the backdrop. Foreground content has strong contrast with both backdrop and backgrounds. Use for most surfaces and elements.
147
+
148
+ **Emphasized:** When an element needs high visual contrast from other content. Emphasized elements rely on the background for visual separation with the backdrop. Use for high-emphasis, core actions you want the user to take.
149
+
150
+ **Emphasized containers:** When a whole container needs emphasis (a card, a panel, a section), the container and everything inside switches to dark mode. This approach maintains visual separation while ensuring all elements maintain their relationship to each other.
151
+ - title: Intensity
152
+ body: |-
153
+ Every tone breaks down into three parts.
154
+
155
+ **Background:** The container color of a UI element.
156
+
157
+ **Separator:** Borders, dividers, anything that creates visual separation.
158
+
159
+ **Foreground:** Content inside the element (text, icons).
160
+
161
+ Every tone part has two intensity values:
162
+
163
+ | Value | Background | Separator | Foreground |
164
+ | :---- | :---- | :---- | :---- |
165
+ | Low | For containers that require a background to visually differentiate from the backdrop. Example: Card | When a subtle visual separator is needed to intensify the visual contrast between itself and its container's background. Examples: Badge and Button | For secondary information that isn't critical for consumption. Examples: Decorative icons and captions |
166
+ | High | For elements that need visual contrast from both backdrop and low backgrounds. Examples: Badge and Button | In cases where the visual separator's appearance is critical to understanding the purpose of the element. Examples: TextInput, Select and other inputs | For primary information that is needed to use the product. Examples: Headers, button labels, icons in icon-only buttons. |
167
+ - title: Accents
168
+ body: |-
169
+ Accents are a sibling of tone and follow the same structure, model and rules. However, accents have no semantic meaning. Use to create visual distinction between elements. Examples include Avatars and data visualization elements.
170
+
171
+ The accent family includes Cyan and Magenta.
172
+ - title: Other key semantic tokens
173
+ body: |-
174
+ - **Backdrop** (`--backdrop`): The bottom layer of the page, behind every surface. It is not the `::backdrop` pseudo-element behind a dialog.
175
+ - **Overlay**: A separation between different layers of UI.
176
+ - **Brand**: For in-product Sanity brand moments.
177
+ - title: Interaction states
178
+ body: |-
179
+ The system handles interaction states for you. You usually don't need to think about them.
180
+
181
+ **Hover:** Calculated as a brightness shift — darker in light mode, lighter in dark mode. These colors are dynamically calculated from the base color.
182
+
183
+ **The active family (`active-*`):** Three interaction states share a single token family. Active tokens are represented by blue. Active tokens have two parts: background and foreground.
184
+
185
+ - *Selected/Checked/On:* Selected menu items are given a blue background. For high-emphasis selections — such as menu items or checkboxes — the background is given a high-contrast blue with the foreground inverted to white. For lower-emphasis selections — such as Tabs — the background is given a low-contrast blue with foreground acting as the main contrast element.
186
+ - *Focused:* Focused elements are given a halo outline with a high-contrast blue color.
187
+
188
+ **Note on naming:** The family is currently called `active` in design. Token names in code are TBD. If you're consuming the system through tokens alone — without seeing the rendered UI — know that the active family covers all three states above. The visual distinction is rendered, not tokenized. When the code names land, this section updates.
189
+
190
+ **The inert family (`inert-*`):** represents elements that aren't interactive. Inert tokens have two parts: background and foreground.
191
+
192
+ - *Read-only:* Read-only elements use an inert background only. The inert background signals the element can't be edited, but the text can still be read and selected.
193
+ - *Disabled:* Disabled elements use inert background and foreground to represent that the entire element provides no interaction.
194
+ - kind: section
195
+ for: all
196
+ freeform:
197
+ - title: Design in grayscale first
198
+ body: Build hierarchy with type, spacing, and contrast before adding hue. An interface that relies on color to work does not work. Color adds to hierarchy; it does not create it.
199
+ - title: Default to `neutral`
200
+ body: If you have no specific reason to choose another tone, `neutral` is the right answer. One emphasized button is an emphasized button. Three are noise.
201
+ - kind: section
202
+ for: all
203
+ freeform:
204
+ - title: Light and dark
205
+ body: |-
206
+ Sanity UI 5 has no theme provider, and no `scheme` prop. Colour scheme is
207
+ plain CSS.
208
+
209
+ The stylesheet sets `color-scheme: light dark` on `:root`, and every
210
+ semantic colour is declared with the CSS `light-dark()` function:
211
+
212
+ ```css
213
+ --background-high: light-dark(var(--gray-100), var(--gray-900));
214
+ ```
215
+
216
+ `light-dark()` reads whichever scheme is in effect. With no further work,
217
+ an app follows the reader's system setting.
218
+
219
+ To force one scheme, set the standard `color-scheme` property:
220
+
221
+ ```css
222
+ :root { color-scheme: dark } /* always dark */
223
+ :root { color-scheme: light } /* always light */
224
+ ```
225
+
226
+ For a user-facing toggle, write that property from React. Nothing else is
227
+ needed — every component re-resolves its colours from the same variables:
228
+
229
+ ```tsx
230
+ function SchemeToggle() {
231
+ const [scheme, setScheme] = useState<'light' | 'dark'>('light')
232
+
233
+ useEffect(() => {
234
+ document.documentElement.style.colorScheme = scheme
235
+ }, [scheme])
236
+
237
+ return (
238
+ <Button
239
+ text={scheme === 'light' ? 'Dark mode' : 'Light mode'}
240
+ onClick={() => setScheme(scheme === 'light' ? 'dark' : 'light')}
241
+ />
242
+ )
243
+ }
244
+ ```
245
+
246
+ `color-scheme` also applies to a subtree. A single panel can be inverted
247
+ without touching the rest of the page.
248
+
249
+ `Card` has no `scheme` prop.
250
+ - kind: section
251
+ for: all
252
+ freeform:
253
+ - title: Semantic CSS custom properties
254
+ body: |-
255
+ Component props cover most colour work. When they cannot reach — a native
256
+ `<td>` border, a custom scrollbar, a `<select>` you cannot replace — read the
257
+ semantic custom properties directly. Each one already resolves for both
258
+ schemes. Using them keeps custom CSS in step with the design system.
259
+
260
+ | Custom property | Use for |
261
+ | --- | --- |
262
+ | `--background-low` | The page or a recessed surface |
263
+ | `--background-high` | A raised surface: card, panel, popover |
264
+ | `--background-high-emphasized` | A filled, high-contrast surface |
265
+ | `--foreground-high` | Primary text and icons |
266
+ | `--foreground-low` | Secondary and muted text |
267
+ | `--separator-low` | Ordinary borders and rules |
268
+ | `--separator-high` | A border that needs to read as deliberate |
269
+ | `--focus-outline` / `--focus-offset` | Matching the focus ring on a custom control |
270
+ | `--backdrop` | The page's bottom layer, behind every surface. Not the `::backdrop` behind a dialog |
271
+ | `--inert-background` / `--inert-foreground` | Disabled surfaces and text |
272
+
273
+ Inside anything carrying a `tone`, these same names remap to that tone's
274
+ ramp. A border written once is neutral in a neutral card and critical in a
275
+ critical one:
276
+
277
+ ```tsx
278
+ <Card tone="critical">
279
+ <table>
280
+ <td style={{ borderBottom: '1px solid var(--separator-low)' }}>…</td>
281
+ </table>
282
+ </Card>
283
+ ```
284
+
285
+ Prefer a prop where one exists. `tone` changes the whole surface together.
286
+ A single custom property changes one declaration. That one declaration can
287
+ drift from the text beside it.
288
+
289
+ **Some variable names do not exist.** `--card-bg-color`,
290
+ `--card-border-color` and `--card-fg-color` resolve to nothing, and the
291
+ usual fallback form is worse than no colour at all:
292
+
293
+ ```css
294
+ /* ✗ pins the colour to the light value in both schemes */
295
+ background: var(--card-bg-color, #fff);
296
+
297
+ /* ✓ resolves per scheme */
298
+ background: var(--background-high);
299
+ ```
300
+
301
+ Base tokens such as `--gray-100` are also the wrong layer for this. Each holds
302
+ one fixed colour and does not respond to the scheme; the semantic names above
303
+ are the ones built to.
304
+ - kind: section
305
+ for: agent
306
+ freeform:
307
+ - title: Intent
308
+ body: Use this guide to understand Sanity UI's color system — including token layers, semantic tones, emphasis, intensity, and interaction states — and to apply color correctly in interface design and token usage.
@@ -0,0 +1,285 @@
1
+ kind: sanity.foundation
2
+ id: content-guidelines
3
+ name: Content guidelines
4
+ description: Rules and principles governing UI copy, naming, labels, casing, internationalization, and truncation in Sanity UI.
5
+ metadata:
6
+ tags: [concept, content, writing, voice, naming, labels, casing, i18n, truncation, copy, tone]
7
+ status:
8
+ status: stable
9
+ sections:
10
+ - kind: guidelines
11
+ for: all
12
+ framing: how-to-use
13
+ items:
14
+ - level: must
15
+ statement: Say what you mean. Cut the rest. Every word earns its place. "Buttons trigger actions." Not "Buttons are interactive elements that allow users to initiate a variety of actions."
16
+ - level: should
17
+ statement: Write for speech. If it sounds like a press release, rewrite it. Read it aloud to test.
18
+ - id: plain-language
19
+ level: must-not
20
+ statement: "Don't use jargon, internal vocabulary or design-speak in user-facing copy, and spell out an acronym the first time it appears. Use short, common words and short sentences. Plain language is an accessibility rule: it serves screen reader users, non-native readers and anyone reading under stress. When a technical term is the only accurate word, explain it in plain words beside it."
21
+ checks:
22
+ - href: ../evals/cases.yaml
23
+ role: agent-test
24
+ checkedBy: assisted
25
+ $extensions:
26
+ io.jev:
27
+ type: boolean
28
+ - level: must-not
29
+ statement: Don't use emojis. Use icons when a visual symbol is needed.
30
+ - kind: guidelines
31
+ for: all
32
+ framing: how-to-use
33
+ items:
34
+ - level: must
35
+ statement: One name per concept, everywhere. The same thing has the same name in the UI, the docs, the code, and the Figma library. Synonyms force translation for humans and mislead agents.
36
+ - level: must
37
+ statement: Names are short, plain, and self-describing. No clever names. No acronyms. A name that becomes an acronym has failed.
38
+ - level: should
39
+ statement: Manage recurring strings as named content tokens. Cancel, generic errors, and other repeats map one concept to one string in one place — for example `error.required-field`. One source keeps the wording in sync.
40
+ - level: should-not
41
+ statement: Avoid names that sound alike. "Tag" and "Tab" sound alike and cause real errors. Fix the names before shipping.
42
+ - kind: guidelines
43
+ for: all
44
+ framing: how-to-use
45
+ items:
46
+ - id: start-with-a-verb
47
+ level: must
48
+ statement: Start with a verb. "Publish," not "Publishing." "Upload image," not "Image upload."
49
+ - id: name-the-action
50
+ level: must
51
+ statement: 'Name the specific action or destination in every label: buttons, links, menu items and accessible names. Generic labels such as "OK", "Submit", "Confirm", "Done", "Yes", "Go", "Click here", "Read more" and "Get started" don''t say what will happen. Out of context they also sound the same, and screen reader users often move through a page by its list of links and buttons (WCAG 2.4.4). Write "Export as CSV", not "Submit"; "Delete 3 items", not "Confirm"; "Read the upload limits", not "Read more".'
52
+ checks:
53
+ - href: ../evals/cases.yaml
54
+ role: agent-test
55
+ checkedBy: assisted
56
+ $extensions:
57
+ io.jev:
58
+ type: boolean
59
+ - id: overflow-labels-stand-alone
60
+ level: must
61
+ statement: Overflow menu labels must stand alone. No icon or tooltip in overflow menus. The label has to be self-sufficient.
62
+ - id: toggle-labels-show-next-action
63
+ level: must
64
+ statement: Toggle labels show the next action. Sidebar shown → "Hide nav." Sidebar hidden → "Show nav."
65
+ - level: should
66
+ statement: Labels tell users what happens before they act. Every label must be honest, brief, and clear.
67
+ - id: group-labels-name-the-group
68
+ level: should
69
+ statement: Group labels name the group, not the action. "Documents," not "Manage documents."
70
+ - id: label-length-by-element
71
+ level: should
72
+ statement: Keep labels within the word limits in the Labels and actions reference below.
73
+ - kind: guidelines
74
+ for: all
75
+ framing: how-to-use
76
+ items:
77
+ - id: sentence-case-all-system-set
78
+ level: must
79
+ statement: Sentence case for all system-set copy. Cap the first word and proper nouns only. This covers headings, titles, labels, options, buttons, menu items, tooltips, errors and status text.
80
+ - level: must
81
+ statement: User- and machine-generated text keeps its original casing. Typed titles, IDs, and URLs are not re-cased.
82
+ - id: keep-proper-noun-casing
83
+ level: must
84
+ statement: Proper nouns, brand names, and common short forms (CSV, JSON, URL) keep their own casing.
85
+ - id: no-period-on-fragments
86
+ level: must
87
+ statement: No dot at the end of fragments. Button labels, menu items, tooltip fragments, and headings carry no dot. Full sentences in body text and errors follow normal rules.
88
+ - id: figures-for-counts
89
+ level: must
90
+ statement: Use figures, not words, for counts. "Delete 3 items," not "Delete three items."
91
+ - id: oxford-comma
92
+ level: must
93
+ statement: Oxford comma in lists of three or more.
94
+ - id: no-exclamation-marks
95
+ level: should-not
96
+ statement: Avoid exclamation marks. They read as forced enthusiasm and don't translate as warmth across cultures.
97
+ - kind: guidelines
98
+ for: all
99
+ framing: how-to-use
100
+ items:
101
+ - id: allow-text-growth
102
+ level: must
103
+ statement: Allow 30–50% growth. German and Finnish labels can run 50% longer than English. Plan layouts for this.
104
+ - level: must
105
+ statement: 'Handle plurals with the platform''s plural rules, not by appending "s". "You have {count, plural, one {# item} other {# items}}." English has two plural forms; some languages have up to six.'
106
+ - id: support-rtl
107
+ level: must
108
+ statement: Support right-to-left scripts. Use `inline-start` and `inline-end` instead of `left` and `right`.
109
+ - id: test-longest-translation
110
+ level: should
111
+ statement: Test labels at their longest translated length. Check that the layout holds.
112
+ - level: should-not
113
+ statement: Avoid directional language in copy. "On the right" and "below" break in right-to-left layouts. They mean nothing to screen reader users. Name the thing instead.
114
+ - id: no-string-concatenation
115
+ level: must-not
116
+ statement: 'No string joining. "You have " + count + " items" breaks where word order differs. Use a template: "You have {count} items."'
117
+ - id: no-idioms
118
+ level: must-not
119
+ statement: No idioms or sayings. "Low-hanging fruit" and "out of the box" do not translate.
120
+ - kind: guidelines
121
+ for: all
122
+ framing: how-to-use
123
+ items:
124
+ - id: ellipsis-for-clipped-text
125
+ level: must
126
+ statement: Use ellipsis (`…`) for clipped text. Use `clip` only for decorative elements.
127
+ - id: system-labels-never-clip
128
+ level: must
129
+ statement: System-set labels — buttons, menu items, headings — must not clip. Write them short.
130
+ - id: truncate-only-generated-text
131
+ level: must
132
+ statement: Truncation is for user- or machine-generated text. Typed titles, auto-generated IDs, and long URLs.
133
+ - level: should
134
+ statement: Truncation is a last resort.
135
+ - id: shorten-before-truncating
136
+ level: should
137
+ statement: Shorten the text first. The best truncation is no truncation.
138
+ - kind: section
139
+ for: all
140
+ freeform:
141
+ - title: Overview
142
+ body: Writing in Sanity UI follows the same discipline as visual design. This page covers the laws that govern reading, then Sanity's stance on applying them, then the rules by content type.
143
+ - title: Principles
144
+ body: |-
145
+ These describe how Sanity UI applies the fundamentals. They are stances, not laws.
146
+
147
+ **Plain by default.** Short words, short sentences, and familiar terms are the baseline. They lower the cost of reading for everyone — non-native readers, stressed users, and assistive-tech users. Reach for a longer or rarer word only when it is the precise one.
148
+
149
+ **Sanity sounds like a knowledgeable colleague.** Direct, calm, and confident. It never sounds salesy, cute, or alarmed. Tone shifts within that voice — calm in an error, brief in a confirmation, warm in an empty state.
150
+
151
+ **Copy belongs to a state.** When the state changes, the copy changes. Each state-driven section below maps to a component state or a pattern flow. The component spec defines when a component enters the state; this doc defines what it says.
152
+
153
+ **One concept, one name, one string.** A thing keeps the same name everywhere, and a recurring string lives in one place. Standard names give predictable results — even when the team thinks the standard name is wrong. A non-standard name is a deliberate cost; document why.
154
+
155
+ **The element comes before the copy.** If a string needs helper text to make sense, the element is the problem. Fix the element first.
156
+ - title: Fundamentals
157
+ body: |-
158
+ These describe how reading and comprehension work. They hold regardless of Sanity. The rules in this document follow from them.
159
+
160
+ **People scan; they don't read.** On screen, people fixate on a few words per line and skip the rest. The words that carry meaning have to come first.
161
+
162
+ **Words are recognized, not decoded.** Reading is fast pattern recognition. Familiar words process at once. Jargon and unusual words slow readers down.
163
+
164
+ **Hierarchy is meaning.** People extract structure before they read content. They expect the most important thing first — in a sentence, a label, and a page.
165
+
166
+ **Concrete sticks; abstract fades.** "Something went wrong" teaches nothing. "Your session expired" is clear.
167
+
168
+ **Voice is constant; tone shifts.** A product has one voice across every surface. Its tone adapts to the moment.
169
+
170
+ **Names set expectations.** Readers and agents make large assumptions from a name alone. Standard, predictable names give predictable results.
171
+
172
+ **Meaning carried by one channel is meaning some people miss.** A signal sent through color alone, or hover alone, reaches only the people who can use that channel. A second channel reaches the rest.
173
+ - kind: section
174
+ for: all
175
+ freeform:
176
+ - title: Content tokens
177
+ body: |-
178
+ Naming above sets the rule: manage recurring concepts as named content tokens, one term per concept. This is the catalog — canonical terms for the concepts that drift most in practice, evidenced by a full audit of Sanity Studio's shipped microcopy (see studio-microcopy-audit-2026-08-18.md). Use the canonical term. Everything under "Retire" is a synonym error, not a stylistic choice.
179
+
180
+ ### Removing and undoing content
181
+
182
+ Six words compete for four distinct operations. Choose by what happens to the data.
183
+
184
+ | Concept | Canonical term | Use for | Retire | Example |
185
+ | --- | --- | --- | --- | --- |
186
+ | Permanently destroy an object | Delete | A document, comment, task, or release that will not come back. | — | "Delete this document? This can't be undone." |
187
+ | Abandon unsaved or unpublished edits | Discard | Return to the last saved or published state. The object itself survives. | — | "Discard changes" |
188
+ | Take an item out of a collection | Remove | The item still exists; only its membership changes. | Take out, exclude | "Remove from release" |
189
+ | Empty a field's value | Clear | The field stays; its content doesn't. | — | "Clear field" |
190
+ | Bring back a deleted object or a prior version | Restore | Undo a delete, or return to a version from history. | Revert | "Restore to this revision" |
191
+
192
+ Retire "Revert." One audited feature (document revision history) names its own button "Revert to revision," while its tooltip, confirm dialog, disabled state, and success toast all say "Restore" for the identical action. Restore is plainer and already wins 4-to-1 within that single feature — standardize on it everywhere.
193
+
194
+ ### Creating and naming new objects
195
+
196
+ "Create" and "New" are not synonyms once split by grammatical role:
197
+
198
+ | Role | Canonical term | Example |
199
+ | --- | --- | --- |
200
+ | Trigger button, menu item (verb-first, per Labels and actions) | Create + noun | "Create document," "Create release" |
201
+ | Dialog title, empty-state heading (noun phrase) | New + noun | "New document," "New release" |
202
+
203
+ Use both, consistently assigned by role. The problem isn't that both words exist — it's a single control disagreeing with its own tooltip and aria-label on which one to use. Every string describing one control must agree.
204
+
205
+ ### The docked side panel
206
+
207
+ | Concept | Canonical term | Retire |
208
+ | --- | --- | --- |
209
+ | A collapsible, docked auxiliary region attached to the main content (comments, tasks, field help) | Panel | Pane, inspector |
210
+ | The primary, persistent navigation rail | Sidebar | — |
211
+
212
+ "Sidebar" and "panel" name different things; keep them that way. "Pane" and "inspector" are retired synonyms for panel.
213
+
214
+ ### The modal surface
215
+
216
+ | Concept | Canonical term | Retire |
217
+ | --- | --- | --- |
218
+ | A focus-trapping overlay that blocks interaction until dismissed | Dialog | Modal |
219
+ | A non-modal, anchored floating surface that doesn't trap focus | Popover | — |
220
+
221
+ "Modal" describes a behavior (focus-trapping), not a component. Use "dialog" for the noun; "modal" only as an adjective if needed ("a modal dialog"). A control that could be described as "popover/dialog" is the bug — every control is one or the other, never both.
222
+
223
+ This row covers the generic UI-pattern vocabulary for product copy and code comments. As of @sanity/ui@5.0.0-alpha.7 the Sanity UI component identifier agrees with it: the component shipped as `Modal` in alpha.5 and was renamed to `Dialog` in alpha.7, so the canonical term and the component name are now the same word. Decision D1 in terminology-glossary-2026-08-18.md, which ruled the other way, was made on the opposite premise and is superseded.
224
+
225
+ ### Problem severity
226
+
227
+ | Concept | Canonical term | Use for | Retire (as a synonym) |
228
+ | --- | --- | --- | --- |
229
+ | Something invalid or broken that blocks progress | Error | Validation failures, failed operations | Issue, when it only ever means "error" |
230
+ | Something that may be a problem but doesn't block progress | Warning | Advisory, non-blocking notices | — |
231
+ | An aggregate that may include both | Issue | Only for a summary count that can mix errors and warnings — for example, "3 issues found" covering 2 errors and 1 warning | — |
232
+
233
+ If a string's own key says error but its value says "issue" — or the reverse — that's a bug, not a style choice.
234
+
235
+ ### Document and schema type errors
236
+
237
+ Use document type for any user-facing error about a specific document's type. Reserve schema type for developer- or config-level errors — a broken schema definition, not a document instance. Never use bare "type" alone in a title; it reads as an error-checker leak, not a sentence a person wrote.
238
+
239
+ ### Needs a product decision, not a copy fix
240
+
241
+ One concept family mixes vocabulary because the underlying product concepts may not be fully settled, not because the copy is careless. Flagged here rather than assigned a canonical term:
242
+
243
+ - Release scheduling. "Content Release," "Release," "Scheduled Draft," and "Scheduled publish" all appear for what looks like overlapping parts of one feature area. Resolve the taxonomy with the product team before naming it here.
244
+
245
+ ### A demo of this catalog as tokens
246
+
247
+ dsds/tokens/content.dsds.json (with its source content.tokens.json) shows what this catalog looks like encoded as DTCG tokens instead of prose tables — one canonical value per concept, retired synonyms and audit evidence attached as metadata. It is a proposal, not a shipped part of @sanity-labs/design-tokens, and it is not wired into the main documentation bundle for that reason.
248
+ - kind: section
249
+ for: all
250
+ freeform:
251
+ - title: Labels and actions reference
252
+ body: |-
253
+ | Element | Length | Verb-first | Example |
254
+ | --- | --- | --- | --- |
255
+ | Button label | 1–3 words | Yes | "Save draft" |
256
+ | Menu item | 1–3 words | Yes | "Rename" |
257
+ | Overflow menu item | 1–5 words | Yes | "Export as CSV" |
258
+ | Nav group label | 1–2 words | No (noun phrase) | "Media library" |
259
+ | Tab label | 1–2 words | No (noun phrase) | "Page settings" |
260
+ | Toggle button | 1–3 words | Yes | "Show inspector" |
261
+ | Badge | 1–3 words | No (noun phrase) | "Published" |
262
+ | Form field label | 1–3 words, longer if needed for clarity | No (noun phrase) | "Email address" |
263
+
264
+ All labels use sentence case (`sentence-case-all-system-set`).
265
+ - kind: section
266
+ for: all
267
+ freeform:
268
+ - title: Pre-ship checklist
269
+ body: |-
270
+ Before any UI string ships:
271
+
272
+ - Fewest words needed?
273
+ - Plain language a newcomer understands?
274
+ - Tells the user what to do, not only what happened?
275
+ - Specific, not generic?
276
+ - Names this concept the same way every other surface does?
277
+ - Matches the tone for this context?
278
+ - Does meaning survive without color? Tone paired with an icon or text?
279
+ - If an error: cause and a path forward, tied to its field?
280
+ - If a string needs helper text to make sense, the element is the problem, not the copy.
281
+ - kind: section
282
+ for: agent
283
+ freeform:
284
+ - title: Intent
285
+ body: Use this guide to evaluate, write, or review UI copy in Sanity UI, ensuring strings follow voice, naming, label, casing, i18n, and truncation rules.