<!-- generated by scripts/gen-docs.mjs from docs/system/writing.md. Edit the source and rerun. -->
# Writing

## Description

Rules for the text inside components, such as button labels, dialog titles, toasts and empty states. All of it is in sentence case. The Slots table gives each kind of text its length and shape.

## Slots

| Slot           | Sources                                                                                         | Rows | Casing   | Max chars | End punctuation | Template                   |
| -------------- | ----------------------------------------------------------------------------------------------- | ---- | -------- | --------- | --------------- | -------------------------- |
| button         | Button, EmptyAction, Pill, StateButton, AlertDialogAction, AlertDialogCancel                    | 0    | sentence | 24        | none            | {Verb} {object}            |
| link           | Link, BackLink                                                                                  | 0    | sentence | 24        | none            | {Object}                   |
| dialog-title   | DialogTitle, AlertDialogTitle, SheetTitle                                                       | 0    | sentence | 48        | none            | {Verb} {object}            |
| dialog-body    | DialogDescription, AlertDialogDescription, SheetDescription                                     | 0    | sentence | 140       | period          | any                        |
| confirm-action | AlertDialogAction                                                                               | 0    | sentence | 24        | none            | {Verb} {object}            |
| toast          | toast(), toast.success(), toast.error()                                                         | 0    | sentence | 60        | none            | {Object} {past-tense verb} |
| status         | StateButton[pendingLabel], StateButton[successLabel], StateButton[failureLabel], Spinner[label] | 0    | sentence | 20        | none            | {Verb-ing}                 |
| empty-title    | EmptyTitle                                                                                      | 0    | sentence | 40        | none            | No {objects} yet           |
| empty-body     | EmptyDescription                                                                                | 0    | sentence | 120       | period          | any                        |
| field-label    | Label                                                                                           | 0    | sentence | 24        | none            | {Object}                   |
| placeholder    | *[placeholder]                                                                                  | 0    | sentence | 32        | none            | {Object}                   |
| tooltip        | TooltipContent, IconButton[label]                                                               | 0    | sentence | 32        | none            | {Verb} {object}            |
| heading        | h1, h2, h3                                                                                      | 0    | sentence | 48        | none            | {Object}                   |

## Usage

### button

- `rule/writing-button-verb`: When a button's label names an action, write the verb and its object in sentence case, such as "Create event", because the label tells you what pressing it does. Evidence: person D11; principle heuristic: match between system and the real world, the label names the outcome. Check: lint copy/template on the button slot (scripts/copy-check.mjs).
  - Don't: `<Button>Submit</Button>`
  - Do: `<Button>Create event</Button>`

### link

- `rule/writing-link-object`: When a link leads somewhere, name the destination, such as "Foundations", because a screen reader can list links out of context. Evidence: principle wcag: 2.4.4 Link purpose in context, the text alone identifies the target; person D11. Check: lint copy/banned-word for "click here" and "learn more" (scripts/copy-check.mjs).
  - Don't: `<Link to="/foundations/colors">Learn more</Link>`
  - Do: `<Link to="/foundations/colors">Foundations</Link>`

### dialog-title

- `rule/writing-dialog-title-verb`: When a dialog asks for a decision or an edit, title it with the verb and the object, such as "Delete event", in sentence case with no period (a confirmation may end in a question mark, such as "Delete event?"), because the title and its confirm button share one verb. Evidence: principle heuristic: consistency and standards, one verb from action to result; person D11. Check: lint copy/casing and copy/end-punctuation on the dialog-title slot (scripts/copy-check.mjs).
  - Don't: `<DialogTitle>Are you sure?</DialogTitle>`
  - Do: `<DialogTitle>Delete event</DialogTitle>`

### dialog-body

- `rule/writing-dialog-body-sentence`: When a dialog explains what will happen, write one or two full sentences in `DialogDescription` that name the object and say what cannot be undone, ending in a period, because the body is where the consequence is stated. Evidence: principle heuristic: help users recognize, diagnose and recover from errors, the consequence is stated before the action; person D11. Check: lint copy/end-punctuation on the dialog-body slot (scripts/copy-check.mjs).
  - Don't: `<DialogDescription>This can't be undone</DialogDescription>`
  - Do: `<DialogDescription>The event and its 12 replies are removed for everyone. This cannot be undone.</DialogDescription>`

### confirm-action

- `rule/writing-confirm-verb-chain`: When an alert dialog confirms a destructive action, its action button repeats the title's verb, such as "Delete event" under the title "Delete event", because a different word such as "Yes" makes you wonder what it confirms. Evidence: principle heuristic: consistency and standards, one verb from action to result; person D11. Check: lint copy/verb-chain (scripts/copy-check.mjs).
  - Don't: `<AlertDialogAction>Yes</AlertDialogAction>`
  - Do: `<AlertDialogAction>Delete event</AlertDialogAction>`

### toast

- `rule/writing-toast-result`: When a toast reports a result, write the object and a past-tense verb, such as "Invitation sent", in sentence case with no period and no exclamation mark, because a toast is read at a glance. Evidence: person D12; principle heuristic: visibility of system status, the result names the object. Check: lint copy/end-punctuation and rule/ban-exclamation (scripts/copy-check.mjs, scripts/check-system.mjs).
  - Don't: `toast("Done!")`
  - Do: `toast("Invitation sent")`

### status

- `rule/writing-status-verb-ing`: When a control reports that it is working, use one word ending in -ing, such as "Saving", at most 20 characters, because a screen reader announces it while the spinner shows, and a short word is quick to hear. Evidence: principle heuristic: visibility of system status, the control shows its own status; person D14. Check: lint copy/max-chars on the status slot (scripts/copy-check.mjs).
  - Don't: `<StateButton status="pending" pendingLabel="Please wait while we save your changes">Save</StateButton>`
  - Do: `<StateButton status="pending" pendingLabel="Saving">Save</StateButton>`

### empty-title

- `rule/writing-empty-title-object`: When a list is empty, the title names what is missing in the app's own words, such as "No mentors yet" or "Nothing saved yet", because you want to know what is missing. Evidence: person D11; principle heuristic: match between system and the real world, the object is named. Check: lint copy/template on the empty-title slot (scripts/copy-check.mjs).
  - Don't: `<EmptyTitle>Oops, nothing here</EmptyTitle>`
  - Do: `<EmptyTitle>No mentors yet</EmptyTitle>`

### empty-body

- `rule/writing-empty-body-why`: When an empty state has a description, write one `EmptyDescription` sentence of at most 120 characters, ending in a period, that says why the list is empty or how to add to it, because that tells you the next step. Evidence: person D11; principle heuristic: help users recognize, diagnose and recover from errors, the way out is named. Check: lint copy/end-punctuation on the empty-body slot (scripts/copy-check.mjs).
  - Don't: `<EmptyDescription>Try adding something</EmptyDescription>`
  - Do: `<EmptyDescription>The bookmark on an opportunity keeps it here.</EmptyDescription>`

### field-label

- `rule/writing-field-label-noun`: When a field is named, the label is the noun for what goes in it, such as "Email", in sentence case with no colon, because a screen reader reads the label as the field's name, colon included. Evidence: principle wcag: 3.3.2 Labels or instructions, the label identifies the input; person D11. Check: lint copy/end-punctuation on the field-label slot (scripts/copy-check.mjs).
  - Don't: `<Label>Email:</Label>`
  - Do: `<Label>Email</Label>`

### placeholder

- `rule/writing-placeholder-not-label`: When a field has a placeholder, make it an example such as "name@school.edu" and name the field with a `Label` or `FieldLabel`, because the placeholder disappears once you type. Evidence: principle wcag: 3.3.2 Labels or instructions, a placeholder is not a label; person D11. Check: lint trap/label-unbound on the field (scripts/check-system.mjs); review.
  - Don't: `<Input placeholder="Email" />`
  - Do: `<Label htmlFor="email">Email</Label> <Input id="email" placeholder="name@school.edu" />`

### tooltip

- `rule/writing-tooltip-is-the-name`: When a control has only an icon, make its tooltip exactly its accessible name, a verb and its object such as "Copy link", because touch screens have no hover, so extra text there is lost. Evidence: person D11; principle platform: tooltips are hover-only, and touch has no hover. Check: lint copy/max-chars on the tooltip slot (scripts/copy-check.mjs); review of IconButton uses.
  - Don't: `<IconButton icon={<CopyIcon />} label="Click to copy the link to this page" />`
  - Do: `<IconButton icon={<CopyIcon />} label="Copy link" />`

### heading

- `rule/writing-heading-sentence-case`: When titling a page or section, write sentence case, such as "Priority order", with no end punctuation and no `uppercase` label above it, because title case makes ordinary words look like names. Evidence: person D11; person D12. Check: lint rule/ban-uppercase (scripts/check-system.mjs); lint copy/casing on the heading slot (scripts/copy-check.mjs).
  - Don't: `<p className="text-xs uppercase">Overview</p><h1>Priority Order</h1>`
  - Do: `<h1>Priority order</h1>`

### Across slots

- `rule/writing-no-em-dash`: When a sentence needs a pause, end the sentence, and when a value is empty, write "None", because a dash in an empty cell looks like a minus sign or a value still loading. Evidence: person D12. Check: lint rule/ban-em-dash (scripts/check-system.mjs).
  - Don't: `<dd>{owner ?? "—"}</dd>`
  - Do: `<dd>{owner ?? "None"}</dd>`
- `rule/writing-no-middle-dot`: When several facts sit on one line, put each in its own `span` with `gap-3`, because a screen reader reads each dot aloud and the line can wrap in the middle of a fact. Evidence: person D12. Check: lint rule/ban-middle-dot (scripts/check-system.mjs).
  - Don't: `` `${city} · ${country} · ${year}` ``
  - Do: `<span>{city}</span><span>{country}</span><span>{year}</span>`
- `rule/writing-no-exclamation`: When copy reports success, write the result as a plain phrase, such as "Changes saved", because an exclamation mark on every success leaves nothing for a real warning. Evidence: person D12. Check: lint rule/ban-exclamation (scripts/check-system.mjs).
  - Don't: `toast("Saved!")`
  - Do: `toast("Changes saved")`
- `rule/writing-no-emoji`: When copy needs emphasis or a mark, use a word or an icon from `@/components/cobalt/icon`, because emoji look different on every platform and screen readers read out their names. Evidence: person D12. Check: lint rule/ban-emoji (scripts/check-system.mjs).
  - Don't: `<EmptyTitle>Nothing here yet \u{1F343}</EmptyTitle>`
  - Do: `<EmptyTitle>Nothing saved yet</EmptyTitle>`
- `rule/writing-no-invented-numbers`: When copy could include a number, use a real count from the data, such as "3 drafts", or leave the number out, because an invented figure such as "Join 2,000 members" is a claim the app cannot back up. Evidence: person D11. Check: review of every number in copy.
  - Don't: `<p>Join thousands of members</p>`
  - Do: `<p>{count} members</p>`

## Verb chains

| Chain | Verb | Action | Confirm title | Confirm action | Result |
| ----- | ---- | ------ | ------------- | -------------- | ------ |

Empty until an app adds a destructive flow. Add one row for each action that asks for confirmation or reports a result. `node scripts/copy-check.mjs --suggest-chains` lists candidates.

## Banned words

| Word        | Instead                 | Evidence                                             |
| ----------- | ----------------------- | ---------------------------------------------------- |
| seamlessly  | cut                     | principle heuristic: aesthetic and minimalist design |
| leverage    | use                     | principle heuristic: aesthetic and minimalist design |
| unlock      | cut, or name what opens | principle heuristic: aesthetic and minimalist design |
| delve       | cut                     | principle heuristic: aesthetic and minimalist design |
| robust      | cut                     | principle heuristic: aesthetic and minimalist design |
| effortless  | cut                     | principle heuristic: aesthetic and minimalist design |
| click here  | the destination's name  | principle wcag: 2.4.4 Link purpose in context        |
| learn more  | the destination's name  | principle wcag: 2.4.4 Link purpose in context        |
| oops        | cut                     | person D11                                           |
| sorry       | cut, say what happened  | person D11                                           |
| please wait | the status word         | person D14                                           |

## Accessibility

An icon-only button's `aria-label` is also its tooltip, so the two always match. A link's text names its destination. Each result is announced once, either by the toaster's live region or by the `role="status"` element in StateButton. This has not been tested with a screen reader yet.
