@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.
- package/README.md +10 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/avatar-counter.dsds.yaml +78 -0
- package/docs/components/avatar-stack.dsds.yaml +96 -0
- package/docs/components/avatar.dsds.yaml +115 -0
- package/docs/components/badge.dsds.yaml +126 -0
- package/docs/components/box.dsds.yaml +223 -0
- package/docs/components/button.dsds.yaml +284 -0
- package/docs/components/card.dsds.yaml +317 -0
- package/docs/components/checkbox.dsds.yaml +204 -0
- package/docs/components/code.dsds.yaml +167 -0
- package/docs/components/container.dsds.yaml +189 -0
- package/docs/components/dialog.dsds.yaml +343 -0
- package/docs/components/divider.dsds.yaml +93 -0
- package/docs/components/eyebrow.dsds.yaml +217 -0
- package/docs/components/flex.dsds.yaml +237 -0
- package/docs/components/grid.dsds.yaml +217 -0
- package/docs/components/h-stack.dsds.yaml +127 -0
- package/docs/components/heading.dsds.yaml +233 -0
- package/docs/components/hotkeys.dsds.yaml +60 -0
- package/docs/components/icon-button.dsds.yaml +220 -0
- package/docs/components/icon.dsds.yaml +275 -0
- package/docs/components/indicator-stack.dsds.yaml +98 -0
- package/docs/components/indicator.dsds.yaml +108 -0
- package/docs/components/inline.dsds.yaml +127 -0
- package/docs/components/kbd.dsds.yaml +59 -0
- package/docs/components/link.dsds.yaml +108 -0
- package/docs/components/list-button-item.dsds.yaml +103 -0
- package/docs/components/list-item-image.dsds.yaml +82 -0
- package/docs/components/list-item-text.dsds.yaml +80 -0
- package/docs/components/list-item.dsds.yaml +148 -0
- package/docs/components/list.dsds.yaml +162 -0
- package/docs/components/popover.dsds.yaml +208 -0
- package/docs/components/press-area.dsds.yaml +279 -0
- package/docs/components/radio.dsds.yaml +198 -0
- package/docs/components/select.dsds.yaml +214 -0
- package/docs/components/skip-to-content.dsds.yaml +110 -0
- package/docs/components/spinner.dsds.yaml +119 -0
- package/docs/components/switch.dsds.yaml +202 -0
- package/docs/components/tab.dsds.yaml +54 -0
- package/docs/components/tabs-list.dsds.yaml +56 -0
- package/docs/components/tabs-panel.dsds.yaml +54 -0
- package/docs/components/tabs.dsds.yaml +104 -0
- package/docs/components/text-area.dsds.yaml +170 -0
- package/docs/components/text-input.dsds.yaml +189 -0
- package/docs/components/text.dsds.yaml +268 -0
- package/docs/components/tooltip-group.dsds.yaml +90 -0
- package/docs/components/tooltip.dsds.yaml +216 -0
- package/docs/components/v-stack.dsds.yaml +155 -0
- package/docs/components/visually-hidden.dsds.yaml +112 -0
- package/docs/evals/cases.yaml +1319 -0
- package/docs/examples/checkbox-2.tsx +57 -0
- package/docs/examples/confirmation-dialogs-1.tsx +27 -0
- package/docs/examples/confirmation-dialogs-2.tsx +55 -0
- package/docs/examples/confirmation-dialogs-3.tsx +28 -0
- package/docs/examples/confirmation-dialogs-4.tsx +38 -0
- package/docs/examples/popover-1.tsx +48 -0
- package/docs/examples/popover-2.tsx +53 -0
- package/docs/foundations/accessibility-guidelines.dsds.yaml +301 -0
- package/docs/foundations/color-guidelines.dsds.yaml +308 -0
- package/docs/foundations/content-guidelines.dsds.yaml +285 -0
- package/docs/foundations/semantics.dsds.yaml +125 -0
- package/docs/foundations/spacing-guidelines.dsds.yaml +226 -0
- package/docs/foundations/typography-guidelines.dsds.yaml +322 -0
- package/docs/icons.dsds.yaml +2513 -0
- package/docs/index.dsds.yaml +515 -0
- package/docs/overview/api-essentials.dsds.yaml +221 -0
- package/docs/overview/component-reference.dsds.yaml +215 -0
- package/docs/overview/designer-contribution-model.dsds.yaml +77 -0
- package/docs/overview/developer-contribution-model.dsds.yaml +362 -0
- package/docs/overview/installation.dsds.yaml +238 -0
- package/docs/overview/quick-start.dsds.yaml +317 -0
- package/docs/overview/resources.dsds.yaml +34 -0
- package/docs/patterns/confirmation-dialogs.dsds.yaml +140 -0
- package/docs/patterns/error-messaging.dsds.yaml +58 -0
- package/docs/patterns/forms.dsds.yaml +356 -0
- package/docs/patterns/layouts.dsds.yaml +403 -0
- package/docs/patterns/loading-states.dsds.yaml +41 -0
- package/docs/patterns/messaging.dsds.yaml +72 -0
- package/docs/patterns/navigation.dsds.yaml +153 -0
- package/docs/patterns/responsive.dsds.yaml +590 -0
- package/docs/tokens/color.dsds.yaml +1158 -0
- package/docs/tokens/container-widths.dsds.yaml +131 -0
- package/docs/tokens/content.dsds.yaml +258 -0
- package/docs/tokens/content.tokens.json +180 -0
- package/docs/tokens/dtcg/README.md +39 -0
- package/docs/tokens/dtcg/css/color.css +107 -0
- package/docs/tokens/dtcg/css/container.css +12 -0
- package/docs/tokens/dtcg/css/fontFamily.css +10 -0
- package/docs/tokens/dtcg/css/fontWeight.css +10 -0
- package/docs/tokens/dtcg/css/index.css +13 -0
- package/docs/tokens/dtcg/css/radius.css +14 -0
- package/docs/tokens/dtcg/css/semantic.css +42 -0
- package/docs/tokens/dtcg/css/shadow.css +22 -0
- package/docs/tokens/dtcg/css/space.css +16 -0
- package/docs/tokens/dtcg/css/typography.css +69 -0
- package/docs/tokens/dtcg/json/color.tokens.json +911 -0
- package/docs/tokens/dtcg/json/container.tokens.json +44 -0
- package/docs/tokens/dtcg/json/fontFamily.tokens.json +10 -0
- package/docs/tokens/dtcg/json/fontWeight.tokens.json +18 -0
- package/docs/tokens/dtcg/json/radius.tokens.json +58 -0
- package/docs/tokens/dtcg/json/semantic.tokens.json +372 -0
- package/docs/tokens/dtcg/json/shadow.tokens.json +599 -0
- package/docs/tokens/dtcg/json/space.tokens.json +72 -0
- package/docs/tokens/dtcg/json/typography.tokens.json +354 -0
- package/docs/tokens/font-family.dsds.yaml +79 -0
- package/docs/tokens/font-weight.dsds.yaml +103 -0
- package/docs/tokens/radius.dsds.yaml +153 -0
- package/docs/tokens/semantic.dsds.yaml +397 -0
- package/docs/tokens/shadow.dsds.yaml +125 -0
- package/docs/tokens/space.dsds.yaml +185 -0
- package/docs/tokens/typography.dsds.yaml +316 -0
- package/llms.txt +108 -0
- package/package.json +6 -3
- package/skills/sanity-ui-5/SKILL.md +158 -0
- package/skills/sanity-ui-5/references/component-choice.md +37 -0
- package/skills/sanity-ui-5/references/components.md +145 -0
- package/skills/sanity-ui-5/references/forms-and-accessibility.md +189 -0
- package/skills/sanity-ui-5/references/migrating-from-v3.md +250 -0
- package/skills/sanity-ui-5/references/props-and-imports.md +169 -0
- package/skills/sanity-ui-5/references/setup.md +177 -0
- package/skills/sanity-ui-5/references/silent-failures.md +33 -0
- package/skills/sanity-ui-5/references/taste.md +53 -0
- package/skills/sanity-ui-5/references/tone-and-color.md +55 -0
- package/src/css/classes/system/shadow.css +45 -0
- package/src/version.ts +2 -2
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
kind: sanity.pattern
|
|
2
|
+
id: forms
|
|
3
|
+
name: Forms
|
|
4
|
+
description: 'Shared guidance for form fields and their inputs (Checkbox, Radio, Switch, TextInput, TextArea, Select) and the copy inside and around them: labels, placeholders, helper text, errors, empty states, success confirmations, and buttons. Rules that hold for every form field live here once; each component page references them and adds only what is specific to that input.'
|
|
5
|
+
metadata:
|
|
6
|
+
tags:
|
|
7
|
+
- form
|
|
8
|
+
- forms
|
|
9
|
+
- input
|
|
10
|
+
- label
|
|
11
|
+
- checkbox
|
|
12
|
+
- radio
|
|
13
|
+
- switch
|
|
14
|
+
- text input
|
|
15
|
+
- text area
|
|
16
|
+
- select
|
|
17
|
+
- validation
|
|
18
|
+
- accessible name
|
|
19
|
+
- tutorial
|
|
20
|
+
- copy
|
|
21
|
+
- UX writing
|
|
22
|
+
- placeholder
|
|
23
|
+
- helper text
|
|
24
|
+
- error message
|
|
25
|
+
- empty state
|
|
26
|
+
- success confirmation
|
|
27
|
+
- buttons
|
|
28
|
+
- voice and tone
|
|
29
|
+
- content tokens
|
|
30
|
+
status:
|
|
31
|
+
status: stable
|
|
32
|
+
sections:
|
|
33
|
+
- kind: guidelines
|
|
34
|
+
for: all
|
|
35
|
+
framing: when-to-use
|
|
36
|
+
title: Choosing a control
|
|
37
|
+
items:
|
|
38
|
+
- id: choose-control-by-option-count
|
|
39
|
+
level: should
|
|
40
|
+
statement: 'Choose the selection control by what the user is choosing: Radio for 2–4 options, Select for 5–20, TextInput with a search pattern for more than 20. Use Checkbox when several options can be chosen at once, and Switch for a binary setting that takes effect immediately.'
|
|
41
|
+
- kind: guidelines
|
|
42
|
+
for: all
|
|
43
|
+
framing: how-to-use
|
|
44
|
+
title: Labels
|
|
45
|
+
items:
|
|
46
|
+
- id: disabled-input-helper-text
|
|
47
|
+
level: must
|
|
48
|
+
statement: A form field with a disabled input must have helper text. It says why the input is off and what turns it on.
|
|
49
|
+
- id: pair-with-visible-label
|
|
50
|
+
level: must
|
|
51
|
+
statement: Give every form field a visible label. The label tells a sighted user what the field is for, and gives the input its accessible name (WCAG 3.3.2 Labels or Instructions, Level A).
|
|
52
|
+
- refs:
|
|
53
|
+
- to: content-guidelines#sentence-case-all-system-set
|
|
54
|
+
rel: same-as
|
|
55
|
+
- id: label-short
|
|
56
|
+
level: should
|
|
57
|
+
statement: Keep labels short, descriptive, and noun phrases. Most fields need one to three words; go longer only when a shorter label would be ambiguous. A label names the field, not the action.
|
|
58
|
+
- refs:
|
|
59
|
+
- to: content-guidelines#label-length-by-element
|
|
60
|
+
rel: same-as
|
|
61
|
+
- id: mark-optional-fields
|
|
62
|
+
level: should
|
|
63
|
+
statement: Mark optional fields as optional in the label, as `Phone number (optional)`, rather than marking required ones. If most fields are optional, mark the required ones instead, and use one convention for the whole form.
|
|
64
|
+
- id: label-no-trailing-period
|
|
65
|
+
level: should-not
|
|
66
|
+
statement: Don't end a label with a period. Labels are not full sentences.
|
|
67
|
+
- id: label-no-trailing-colon
|
|
68
|
+
level: should-not
|
|
69
|
+
statement: Don't end a label with a colon. The visual relationship between a label and its input already conveys "this labels that".
|
|
70
|
+
- id: placeholder-not-a-label
|
|
71
|
+
level: must-not
|
|
72
|
+
statement: Don't use placeholder text as the label, or as a replacement for one. A placeholder disappears as soon as the user types and is unreliable for screen readers (WCAG 3.3.2). Pair the input with a visible label.
|
|
73
|
+
evidence:
|
|
74
|
+
- href: https://www.w3.org/WAI/WCAG22/Understanding/label-in-name.html
|
|
75
|
+
role: WCAG 3.3.2 Labels or Instructions
|
|
76
|
+
- id: no-nested-label-elements
|
|
77
|
+
level: must-not
|
|
78
|
+
statement: Don't nest a label element inside another label element. Nested labels are invalid HTML and break the accessible name.
|
|
79
|
+
- kind: guidelines
|
|
80
|
+
for: all
|
|
81
|
+
framing: how-to-use
|
|
82
|
+
title: Layout
|
|
83
|
+
items:
|
|
84
|
+
- id: stack-fields-vertically
|
|
85
|
+
level: should
|
|
86
|
+
statement: Lay out form fields (defined as the paired composition of label + input) vertically. Place fields side by side only for a small group of closely related fields.
|
|
87
|
+
- kind: guidelines
|
|
88
|
+
for: all
|
|
89
|
+
framing: how-to-use
|
|
90
|
+
title: State
|
|
91
|
+
items:
|
|
92
|
+
- id: pair-checked-with-onchange
|
|
93
|
+
level: must
|
|
94
|
+
statement: Pair `checked` with `onChange` on every controlled Checkbox, Radio and Switch. A control with `checked` set and no `onChange` looks interactive but never updates — a common generated-code bug.
|
|
95
|
+
- id: stack-options-vertically
|
|
96
|
+
level: should
|
|
97
|
+
statement: Lay out a group of Checkbox or Radio options vertically for easier scanning.
|
|
98
|
+
- id: no-mixed-controlled-uncontrolled
|
|
99
|
+
level: must-not
|
|
100
|
+
statement: Don't set both `checked` and `defaultChecked` on the same Checkbox, Radio or Switch. Choose one pattern — controlled or uncontrolled — per instance; mixing them produces inconsistent behaviour.
|
|
101
|
+
- kind: guidelines
|
|
102
|
+
for: all
|
|
103
|
+
title: Accessibility
|
|
104
|
+
tags:
|
|
105
|
+
- accessibility
|
|
106
|
+
items:
|
|
107
|
+
- id: aria-label-overrides-name
|
|
108
|
+
level: must
|
|
109
|
+
statement: "`aria-label` overrides the accessible name screen readers announce. Prefer wrapping a fully descriptive `label` in `VisuallyHidden` first, and use `aria-label` only when that isn't practical. Checkbox, Radio and Switch forward it directly to the underlying `<input>`."
|
|
110
|
+
- id: aria-labelledby-references-name
|
|
111
|
+
level: must
|
|
112
|
+
statement: "`aria-labelledby` takes another element's `id` and uses that element's text as the control's accessible name, as an alternative to `aria-label`. Use it when the more specific descriptive text already exists elsewhere in the DOM. Checkbox, Radio and Switch forward it directly to the underlying `<input>`."
|
|
113
|
+
- id: label-available-to-screen-readers
|
|
114
|
+
level: must
|
|
115
|
+
statement: Give every form field a label that screen readers can reach. Keep the label visible by default. Hide it with VisuallyHidden only where the layout already shows what the field is for, such as a row checkbox in a table.
|
|
116
|
+
- id: programmatic-name-required
|
|
117
|
+
level: should
|
|
118
|
+
statement: An input with no programmatic name is a critical violation. Link a visible label to the input with `id` and `htmlFor`, or have the input render its own `<label>`. Use `aria-label` or `aria-labelledby` only when there is no visible text to link (WCAG 4.1.2 Name, Role, Value).
|
|
119
|
+
- id: error-prop-needs-visible-message
|
|
120
|
+
level: should
|
|
121
|
+
statement: When setting `hasError`, always render a visible error message near the field. The prop sets the error styling and `aria-invalid`, but it adds no description, so link the message with `aria-describedby`.
|
|
122
|
+
- id: border-contrast
|
|
123
|
+
level: should
|
|
124
|
+
statement: Field border color contrast must reach 3:1 against its background (WCAG 1.4.11).
|
|
125
|
+
- id: placeholder-contrast
|
|
126
|
+
level: should
|
|
127
|
+
statement: Placeholder text needs the a minumum 4.5:1 color contrast (WCAG 1.4.3).
|
|
128
|
+
- id: field-group-name
|
|
129
|
+
level: should
|
|
130
|
+
statement: '**A field inside a group still needs its own name.** A`legend` only names the group. Fields in a group require their own labels, or point at the legend with `aria-labelledby`.'
|
|
131
|
+
- id: error-described-in-text
|
|
132
|
+
level: should
|
|
133
|
+
statement: |-
|
|
134
|
+
A field in an error state needs the error described in text, linked to the field with `aria-describedby` so assistive technology announces the error with the field (WCAG 3.3.1). Write the message to the Error messaging rules: name what failed, and state the next step (`error-messaging#name-what-failed`, WCAG 3.3.3).
|
|
135
|
+
```tsx
|
|
136
|
+
// ✗ — axe critical: no accessible name, error is color-only
|
|
137
|
+
<TextInput hasError value={value} onChange={onChange} />
|
|
138
|
+
// ✓ — labeled, and the error is described in linked text
|
|
139
|
+
<VStack gap={2}>
|
|
140
|
+
<Text as="label" htmlFor="email">Email address</Text>
|
|
141
|
+
<TextInput id="email" hasError aria-describedby="email-error" value={value} onChange={onChange} />
|
|
142
|
+
<Text id="email-error" size={1} tone="critical">Error: Enter a valid email address.</Text>
|
|
143
|
+
</VStack>
|
|
144
|
+
```
|
|
145
|
+
- kind: guidelines
|
|
146
|
+
for: all
|
|
147
|
+
framing: how-to-use
|
|
148
|
+
tags:
|
|
149
|
+
- content
|
|
150
|
+
items:
|
|
151
|
+
- refs:
|
|
152
|
+
- to: error-messaging#name-what-failed
|
|
153
|
+
rel: same-as
|
|
154
|
+
- refs:
|
|
155
|
+
- to: error-messaging#state-next-step
|
|
156
|
+
rel: same-as
|
|
157
|
+
- refs:
|
|
158
|
+
- to: error-messaging#field-error-names-field
|
|
159
|
+
rel: same-as
|
|
160
|
+
- level: must
|
|
161
|
+
statement: Use action-oriented button labels that describe the action, not the state. "Submit," "OK," and "Done" don't say what will happen or that it has happened yet.
|
|
162
|
+
refines:
|
|
163
|
+
- to: content-guidelines#name-the-action
|
|
164
|
+
- level: must
|
|
165
|
+
statement: A destructive confirmation button must echo the action ("Delete project"), not read as a generic "Confirm."
|
|
166
|
+
refines:
|
|
167
|
+
- to: content-guidelines#name-the-action
|
|
168
|
+
- level: should
|
|
169
|
+
statement: Show an example in a placeholder, not a description of the field. `example@domain.com` beats "Enter your email address."
|
|
170
|
+
- level: should
|
|
171
|
+
statement: Keep placeholder text short — one example format or one short phrase. Placeholder text competes with what the user types.
|
|
172
|
+
- level: should
|
|
173
|
+
statement: In a top-of-form error summary, name the total number of fields needing attention and link or scroll to the first error field, instead of listing every error again. The inline field errors already list the specifics; the summary's job is to orient, not repeat.
|
|
174
|
+
- level: should
|
|
175
|
+
statement: State what happened in a success confirmation, and avoid exclamation points unless the context truly warrants excitement. "Project created." is specific; "Success!" and "You're all set!" say nothing about what happened.
|
|
176
|
+
- level: should
|
|
177
|
+
statement: Route a form string to a content token once the same string appears in three or more places. Recurring form strings — generic error tones, common placeholder shapes, common button labels — are candidates for tokenization once repeated. Route to Frontend Engineer for the implementation side; content designer owns the naming and canonical values.
|
|
178
|
+
- level: should-not
|
|
179
|
+
statement: Don't use placeholders to carry required format rules. If the format matters, use helper text below the field — it stays visible after the user starts typing, unlike a placeholder, which is also often low-contrast (WCAG 1.4.3).
|
|
180
|
+
- level: must-not
|
|
181
|
+
statement: Don't write an apologetic or hostile error tone. "Sorry, that email looks wrong" is wrong — the system isn't sorry, it's wrong. "INVALID INPUT" or "You entered this incorrectly" blames the user. Be factual and helpful instead.
|
|
182
|
+
- level: must-not
|
|
183
|
+
statement: Don't show empty-state copy while a Select's options are still loading — leave a combobox with only a disabled input and no message. The user can't tell if the system is broken or the list is empty.
|
|
184
|
+
- level: must-not
|
|
185
|
+
statement: Don't mix `Cancel`, `Back`, and `Close` on the same control — each implies a different result (abandon without saving, return to a previous step, dismiss with nothing pending).
|
|
186
|
+
example:
|
|
187
|
+
title: Examples
|
|
188
|
+
description: Cancel abandons the change without saving. Back returns to a previous step. Close dismisses a dialog when no action is pending.
|
|
189
|
+
- kind: steps
|
|
190
|
+
for: all
|
|
191
|
+
ordered: false
|
|
192
|
+
title: The form copy checklist
|
|
193
|
+
items:
|
|
194
|
+
- title: Every field has a clear label (not placeholder-as-label).
|
|
195
|
+
- title: Optional fields are marked; required is implied.
|
|
196
|
+
- optional: true
|
|
197
|
+
title: Placeholders show examples, not instructions.
|
|
198
|
+
- optional: true
|
|
199
|
+
title: Helper text adds information; no filler.
|
|
200
|
+
- title: Errors name the field and explain how to fix.
|
|
201
|
+
- title: Error tone is factual, not apologetic or hostile.
|
|
202
|
+
- title: Empty states are handled (Select, combobox, multi-select).
|
|
203
|
+
- title: Button labels describe actions, not states.
|
|
204
|
+
- optional: true
|
|
205
|
+
title: No "Submit", "OK", "Done", or "Success!".
|
|
206
|
+
- optional: true
|
|
207
|
+
title: Voice is consistent across the form.
|
|
208
|
+
- optional: true
|
|
209
|
+
title: Recurring copy has been considered for tokenization.
|
|
210
|
+
- kind: section
|
|
211
|
+
for: all
|
|
212
|
+
freeform:
|
|
213
|
+
- title: Overview
|
|
214
|
+
body: |-
|
|
215
|
+
A reference for writing the copy that lives inside and around form fields: labels, placeholders, helper text, error messages, empty states, and the small decisions that make forms feel cared for or sloppy.
|
|
216
|
+
|
|
217
|
+
The governing idea: **forms are mostly words.** The input is a rectangle; the words tell the user what to do, what's happening, and what went wrong. Sloppy form copy is sloppy design — no matter how clean the rectangles look.
|
|
218
|
+
- kind: guidelines
|
|
219
|
+
for: all
|
|
220
|
+
framing: how-to-use
|
|
221
|
+
title: Label copy
|
|
222
|
+
items:
|
|
223
|
+
- id: label-present-tense
|
|
224
|
+
level: should
|
|
225
|
+
statement: 'Write labels in the present tense, with the second person implied: `Delivery address`, not `Your delivery address`.'
|
|
226
|
+
example:
|
|
227
|
+
title: Examples
|
|
228
|
+
description: ✅ `Delivery address`, `Date of birth`. ❌ `Your delivery address`, `Enter your date of birth`.
|
|
229
|
+
- id: label-not-question-or-instruction
|
|
230
|
+
level: must-not
|
|
231
|
+
statement: Don't write a label as a question, an instruction, or a request. The label names the field; instructions go in helper text or a placeholder.
|
|
232
|
+
example:
|
|
233
|
+
title: Examples
|
|
234
|
+
description: ❌ `What's your name?`, `Please enter your password`, `Type your email below`. ✅ `Name`, `Password`.
|
|
235
|
+
- kind: guidelines
|
|
236
|
+
for: all
|
|
237
|
+
framing: how-to-use
|
|
238
|
+
title: Placeholder copy
|
|
239
|
+
items:
|
|
240
|
+
- id: placeholder-format
|
|
241
|
+
level: should
|
|
242
|
+
statement: Lead an example placeholder with `ex:`, and don't use `ex:` for a format or a constraint. Use sentence case, and no trailing punctuation unless the example includes it.
|
|
243
|
+
example:
|
|
244
|
+
title: Examples
|
|
245
|
+
description: '✅ `ex: Jane Cooper`, `(555) 123-4567`, `Letters and numbers only`, `you@example.com`. ❌ `[Your email here]`, `example@example.com`, `Name` (restates the label).'
|
|
246
|
+
- kind: guidelines
|
|
247
|
+
for: all
|
|
248
|
+
framing: how-to-use
|
|
249
|
+
title: Helper text
|
|
250
|
+
items:
|
|
251
|
+
- id: helper-text-when-to-use
|
|
252
|
+
level: should
|
|
253
|
+
statement: Use helper text when a field has a constraint the user needs upfront, a format to match, an optional field whose purpose isn't obvious, or a choice with lasting consequences.
|
|
254
|
+
example:
|
|
255
|
+
title: Examples
|
|
256
|
+
description: ✅ `Must be at least 12 characters with one number.`, `Use the format YYYY-MM-DD.`, `We'll only contact you about urgent issues.`
|
|
257
|
+
- id: helper-text-format
|
|
258
|
+
level: should
|
|
259
|
+
statement: Write helper text as a complete sentence in sentence case, ending with a period. Keep it under 100 characters, and under 60 when possible, in plain language.
|
|
260
|
+
- id: helper-text-no-filler
|
|
261
|
+
level: should-not
|
|
262
|
+
statement: Don't write helper text that repeats the label, the placeholder, or the error, or that adds no information. Leave it out instead.
|
|
263
|
+
example:
|
|
264
|
+
title: Examples
|
|
265
|
+
description: '❌ `Enter a valid email address` under an `Email address` label, or `Enter your name` under a placeholder of `ex: Jane Cooper`.'
|
|
266
|
+
- id: helper-text-not-for-irreversible
|
|
267
|
+
level: should-not
|
|
268
|
+
statement: Don't use helper text for an irreversible decision. Use a caution callout near the action instead.
|
|
269
|
+
example:
|
|
270
|
+
title: Examples
|
|
271
|
+
description: ❌ `Choose carefully. This can't be changed later.` as helper text.
|
|
272
|
+
- kind: guidelines
|
|
273
|
+
for: all
|
|
274
|
+
framing: how-to-use
|
|
275
|
+
title: Error copy
|
|
276
|
+
items:
|
|
277
|
+
- id: error-anatomy
|
|
278
|
+
level: should
|
|
279
|
+
statement: Name the field or problem, state the cause briefly, and say what to do when action is needed.
|
|
280
|
+
example:
|
|
281
|
+
title: Examples
|
|
282
|
+
description: ✅ `Email address is missing an @ symbol. Use the format name@example.com.` ❌ `Invalid input.`, `Please correct the errors above.`, `INVALID EMAIL`.
|
|
283
|
+
- id: error-format
|
|
284
|
+
level: should
|
|
285
|
+
statement: Write error messages in sentence case, ending with a period, in two sentences at most, as the error messaging pattern sets.
|
|
286
|
+
refs:
|
|
287
|
+
- to: error-messaging
|
|
288
|
+
rel: relates-to
|
|
289
|
+
- kind: guidelines
|
|
290
|
+
for: all
|
|
291
|
+
framing: how-to-use
|
|
292
|
+
title: Empty states
|
|
293
|
+
items:
|
|
294
|
+
- id: empty-select-default
|
|
295
|
+
level: should
|
|
296
|
+
statement: When a Select or combobox has nothing chosen yet, show `Select` or `Choose an option`. Don't decorate the placeholder with `-- Select --` or `[Choose]`.
|
|
297
|
+
- id: empty-no-matches
|
|
298
|
+
level: should
|
|
299
|
+
statement: When a search has no matches, say so briefly. Echo the query back when it helps.
|
|
300
|
+
example:
|
|
301
|
+
title: Examples
|
|
302
|
+
description: ✅ `No matches found.`, `No results for "[query]".`
|
|
303
|
+
- kind: guidelines
|
|
304
|
+
for: all
|
|
305
|
+
framing: how-to-use
|
|
306
|
+
title: Button verbs
|
|
307
|
+
items:
|
|
308
|
+
- id: button-verb-matches-action
|
|
309
|
+
level: should
|
|
310
|
+
statement: 'Match the button verb to the action: `Create` for creating, `Save changes` or `Update` for editing, and a destructive verb such as `Delete`, `Remove`, or `Cancel subscription` for destructive actions.'
|
|
311
|
+
example:
|
|
312
|
+
title: Examples
|
|
313
|
+
description: ✅ `Create project`, `Save changes`, `Send invitation`. ❌ `Submit`, `OK`, `Done` (past tense, but nothing is done yet).
|
|
314
|
+
- kind: guidelines
|
|
315
|
+
for: all
|
|
316
|
+
framing: how-to-use
|
|
317
|
+
title: Voice
|
|
318
|
+
items:
|
|
319
|
+
- id: voice-direct
|
|
320
|
+
level: should
|
|
321
|
+
statement: Be direct. Write `Name`, not `Could you please tell us your name?`
|
|
322
|
+
- id: voice-plain
|
|
323
|
+
level: should
|
|
324
|
+
statement: Be plain. Write `Must be at least 12 characters`, not `Please ensure your password meets the minimum length requirements.`
|
|
325
|
+
- id: voice-specific
|
|
326
|
+
level: should
|
|
327
|
+
statement: Be specific. Write `Email address must include an @ symbol`, not `Invalid email.`
|
|
328
|
+
- id: voice-kind
|
|
329
|
+
level: must-not
|
|
330
|
+
statement: Don't blame the user, and don't apologize on the software's behalf. Say what is true and what to do next.
|
|
331
|
+
- kind: guidelines
|
|
332
|
+
for: agent
|
|
333
|
+
framing: how-to-use
|
|
334
|
+
title: Extending the patterns
|
|
335
|
+
items:
|
|
336
|
+
- id: extend-doc-for-new-form-shapes
|
|
337
|
+
level: should
|
|
338
|
+
statement: When a new form shape isn't covered here, extend this doc before writing its copy, so the next person follows a pattern rather than an invention. Route publishing to the Technical Writer.
|
|
339
|
+
- kind: section
|
|
340
|
+
for: agent
|
|
341
|
+
freeform:
|
|
342
|
+
- title: Intent
|
|
343
|
+
body: Write form copy — labels, placeholders, helper text, errors, empty states, success confirmations, and buttons — that is direct, plain, specific, and kind, and that follows the format rules for each copy type below.
|
|
344
|
+
refs:
|
|
345
|
+
- to: checkbox
|
|
346
|
+
rel: relates-to
|
|
347
|
+
- to: radio
|
|
348
|
+
rel: relates-to
|
|
349
|
+
- to: switch
|
|
350
|
+
rel: relates-to
|
|
351
|
+
- to: text-input
|
|
352
|
+
rel: relates-to
|
|
353
|
+
- to: text-area
|
|
354
|
+
rel: relates-to
|
|
355
|
+
- to: select
|
|
356
|
+
rel: relates-to
|