@salesforce/mcp-provider-lwc-experts 0.6.3 → 0.6.4
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/index.bundle.js +109 -117
- package/knowledge/graphql/generation-guide.md +212 -0
- package/knowledge/graphql/generation-mutation.md +265 -0
- package/knowledge/graphql/generation-query.md +235 -0
- package/knowledge/graphql/generation-schema.md +20 -0
- package/knowledge/graphql/schema/shared.graphqls +1140 -0
- package/knowledge/o11y/activityApi.md +64 -0
- package/knowledge/o11y/bestPractices.md +106 -0
- package/knowledge/o11y/counterMetrics.md +61 -0
- package/knowledge/o11y/errorTracking.md +70 -0
- package/knowledge/o11y/initialization.md +46 -0
- package/knowledge/o11y/lifecycleInstrumentation.md +91 -0
- package/knowledge/o11y/logApi.md +53 -0
- package/knowledge/o11y/schemaUsage.md +48 -0
- package/knowledge/slds/styling-hooks/README.md +408 -0
- package/knowledge/slds/styling-hooks/categories/color.md +963 -0
- package/knowledge/slds/styling-hooks/categories/radius.md +526 -0
- package/knowledge/slds/styling-hooks/categories/shadow.md +489 -0
- package/knowledge/slds/styling-hooks/categories/sizing.md +667 -0
- package/knowledge/slds/styling-hooks/categories/spacing.md +501 -0
- package/knowledge/slds/styling-hooks/categories/typography.md +708 -0
- package/knowledge/slds/styling-hooks/global-semantic/accent-hooks.md +207 -0
- package/knowledge/slds/styling-hooks/global-semantic/feedback-hooks.md +819 -0
- package/knowledge/slds/styling-hooks/global-semantic/surface-hooks.md +215 -0
- package/knowledge/slds/styling-hooks/guidance.md +906 -0
- package/knowledge/slds/styling-hooks/metadata/hooks-index.json +6576 -0
- package/knowledge/utam/generation-guide.md +499 -0
- package/knowledge/utam/generation-workflow.md +243 -0
- package/knowledge/utam/namespaces-mapping.md +26 -0
- package/knowledge/utam/utam-json-schema.md +720 -0
- package/knowledge/utils.ts +27 -0
- package/package.json +4 -3
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-create-list-info.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-create-record.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-delete-list-info.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-delete-record.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-info-by-name.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-infos-by-name.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-infos-by-object-name.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-object-info.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-preferences.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-get-list-records-by-name.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-list-info.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-list-preferences.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/reference-update-record.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/lds-wire-adapter-types.json +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-count.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info-batch.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-info.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records-batch.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-list-records.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-get-related-lists-info.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-info.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-object-infos.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values-record.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-picklist-values.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-record.md +0 -0
- /package/{agents → experts}/lds/resources/lwc/guides/reference/wire-adapters/reference-wire-adapters-records.md +0 -0
|
@@ -0,0 +1,708 @@
|
|
|
1
|
+
# SLDS Typography System: Comprehensive Guide for Coding Agents
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The SLDS typography system includes **46 typography hooks** (10% of all 473 global hooks) plus **3 font family hooks** for a total of 49 font-related hooks. These provide a complete type system including families, weights, line heights, and sizes.
|
|
6
|
+
|
|
7
|
+
**Total Typography Hooks:** 49
|
|
8
|
+
|
|
9
|
+
- **Font Families:** 3 hooks (`font-family`, `font-family-base`, `font-family-monospace`)
|
|
10
|
+
- **Font Weights:** 7 hooks (`font-weight-1` through `font-weight-7`)
|
|
11
|
+
- **Line Heights:** 6+ hooks (`font-lineheight-1` through `font-lineheight-6`, plus base variants)
|
|
12
|
+
- **Font Sizes:** 33+ hooks (various numbered sizes in metadata)
|
|
13
|
+
|
|
14
|
+
**Key Principle:** SLDS typography uses **numbered systems** (not named like "bold" or "medium") to provide precise control and density-aware scaling.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Font Families
|
|
19
|
+
|
|
20
|
+
### Available Families
|
|
21
|
+
|
|
22
|
+
| Hook | Typical Value | Use For |
|
|
23
|
+
| -------------------------------- | ------------------------------------ | ----------------------------- |
|
|
24
|
+
| `--slds-g-font-family` | "Salesforce Sans", Arial, sans-serif | Default for all text |
|
|
25
|
+
| `--slds-g-font-family-base` | "Salesforce Sans", Arial, sans-serif | Same as above (alias) |
|
|
26
|
+
| `--slds-g-font-family-monospace` | Monaco, Menlo, Consolas, monospace | Code snippets, technical text |
|
|
27
|
+
|
|
28
|
+
### Usage
|
|
29
|
+
|
|
30
|
+
```css
|
|
31
|
+
/* Default body text */
|
|
32
|
+
body {
|
|
33
|
+
font-family: var(--slds-g-font-family-base);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* Code blocks */
|
|
37
|
+
code,
|
|
38
|
+
pre {
|
|
39
|
+
font-family: var(--slds-g-font-family-monospace);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Most components */
|
|
43
|
+
.component {
|
|
44
|
+
font-family: var(--slds-g-font-family); /* Same as base */
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Note:** In most cases, use `font-family-base`. The distinction between `font-family` and `font-family-base` is minimal in current implementation.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Font Weights (Numbered System)
|
|
53
|
+
|
|
54
|
+
### Complete Weight Scale
|
|
55
|
+
|
|
56
|
+
SLDS uses **numbered font weights** (1-7) instead of named weights. This provides precise control and consistency.
|
|
57
|
+
|
|
58
|
+
| Hook | Typical Value | Common Name Equivalent | Use For |
|
|
59
|
+
| ------------------------ | ------------- | ---------------------- | --------------------------- |
|
|
60
|
+
| `--slds-g-font-weight-1` | 300 | Light | Subtle text, large headings |
|
|
61
|
+
| `--slds-g-font-weight-2` | 300 | Light | Alternative light weight |
|
|
62
|
+
| `--slds-g-font-weight-3` | 400 | Regular | Body text, paragraphs |
|
|
63
|
+
| `--slds-g-font-weight-4` | 400 | Regular | Default body weight |
|
|
64
|
+
| `--slds-g-font-weight-5` | 500 | Medium | Semi-emphasis, subheadings |
|
|
65
|
+
| `--slds-g-font-weight-6` | 600 | Semi-Bold | Strong subheadings |
|
|
66
|
+
| `--slds-g-font-weight-7` | 700 | Bold | Headings, emphasis, buttons |
|
|
67
|
+
|
|
68
|
+
### Weight Selection Guide
|
|
69
|
+
|
|
70
|
+
**Light Weights (1-2):**
|
|
71
|
+
|
|
72
|
+
```css
|
|
73
|
+
/* Large hero text */
|
|
74
|
+
.hero-title {
|
|
75
|
+
font-size: 3rem;
|
|
76
|
+
font-weight: var(--slds-g-font-weight-1); /* Light - reduces visual weight at large sizes */
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Regular Weights (3-4):**
|
|
81
|
+
|
|
82
|
+
```css
|
|
83
|
+
/* Body text - most common */
|
|
84
|
+
.body-text {
|
|
85
|
+
font-size: 0.875rem; /* 14px */
|
|
86
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular - standard readability */
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.paragraph {
|
|
90
|
+
font-weight: var(--slds-g-font-weight-3); /* Also regular */
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Medium Weights (5-6):**
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
/* Subheadings, labels */
|
|
98
|
+
.subheading {
|
|
99
|
+
font-weight: var(--slds-g-font-weight-5); /* Medium - subtle emphasis */
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.form-label {
|
|
103
|
+
font-weight: var(--slds-g-font-weight-6); /* Semi-bold - stronger labels */
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Bold Weight (7):**
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
/* Headings, strong emphasis */
|
|
111
|
+
.heading {
|
|
112
|
+
font-weight: var(--slds-g-font-weight-7); /* Bold - maximum emphasis */
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.button-text {
|
|
116
|
+
font-weight: var(--slds-g-font-weight-7); /* Bold - action emphasis */
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
strong,
|
|
120
|
+
.strong {
|
|
121
|
+
font-weight: var(--slds-g-font-weight-7); /* Bold text inline */
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Common Mistakes
|
|
126
|
+
|
|
127
|
+
```css
|
|
128
|
+
/* ❌ WRONG - Named weights don't exist */
|
|
129
|
+
.element {
|
|
130
|
+
font-weight: var(--slds-g-font-weight-bold);
|
|
131
|
+
font-weight: var(--slds-g-font-weight-medium);
|
|
132
|
+
font-weight: var(--slds-g-font-weight-regular);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* ✅ CORRECT - Use numbered weights */
|
|
136
|
+
.element-bold {
|
|
137
|
+
font-weight: var(--slds-g-font-weight-7); /* Bold */
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.element-medium {
|
|
141
|
+
font-weight: var(--slds-g-font-weight-5); /* Medium */
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.element-regular {
|
|
145
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Line Heights (Numbered System)
|
|
152
|
+
|
|
153
|
+
### Available Line Heights
|
|
154
|
+
|
|
155
|
+
| Hook | Typical Value | Use For |
|
|
156
|
+
| ------------------------------- | ------------- | ----------------------------- |
|
|
157
|
+
| `--slds-g-font-lineheight-base` | 1.5 | Default body text |
|
|
158
|
+
| `--slds-g-font-lineheight-1` | ~1.25 | Tight line height, headings |
|
|
159
|
+
| `--slds-g-font-lineheight-2` | ~1.375 | Compact headings |
|
|
160
|
+
| `--slds-g-font-lineheight-3` | ~1.5 | Standard body text |
|
|
161
|
+
| `--slds-g-font-lineheight-4` | ~1.625 | Generous body text |
|
|
162
|
+
| `--slds-g-font-lineheight-5` | ~1.75 | Extra spacing for readability |
|
|
163
|
+
| `--slds-g-font-lineheight-6` | ~2.0 | Maximum spacing |
|
|
164
|
+
|
|
165
|
+
### Line Height Selection Guide
|
|
166
|
+
|
|
167
|
+
**Tight Line Heights (1-2):**
|
|
168
|
+
|
|
169
|
+
```css
|
|
170
|
+
/* Headings - tighter for impact */
|
|
171
|
+
.heading-large {
|
|
172
|
+
font-size: 2rem;
|
|
173
|
+
line-height: var(--slds-g-font-lineheight-1); /* ~1.25 - tight for large text */
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.heading-standard {
|
|
177
|
+
font-size: 1.5rem;
|
|
178
|
+
line-height: var(--slds-g-font-lineheight-2); /* ~1.375 - compact */
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Standard Line Heights (3-4):**
|
|
183
|
+
|
|
184
|
+
```css
|
|
185
|
+
/* Body text - comfortable reading */
|
|
186
|
+
.body-text {
|
|
187
|
+
font-size: 0.875rem;
|
|
188
|
+
line-height: var(--slds-g-font-lineheight-3); /* ~1.5 - standard */
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.paragraph {
|
|
192
|
+
line-height: var(--slds-g-font-lineheight-4); /* ~1.625 - generous */
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Generous Line Heights (5-6):**
|
|
197
|
+
|
|
198
|
+
```css
|
|
199
|
+
/* Long-form content - maximum readability */
|
|
200
|
+
.article-text {
|
|
201
|
+
font-size: 1rem;
|
|
202
|
+
line-height: var(--slds-g-font-lineheight-5); /* ~1.75 - extra space */
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.lead-text {
|
|
206
|
+
font-size: 1.125rem;
|
|
207
|
+
line-height: var(--slds-g-font-lineheight-6); /* ~2.0 - maximum */
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Accessibility Consideration
|
|
212
|
+
|
|
213
|
+
**Minimum line height:** WCAG recommends at least **1.5** for body text (line-height-3 or higher).
|
|
214
|
+
|
|
215
|
+
```css
|
|
216
|
+
/* ✅ ACCESSIBLE - Meets WCAG 1.5 minimum */
|
|
217
|
+
.body {
|
|
218
|
+
line-height: var(--slds-g-font-lineheight-3); /* 1.5 */
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* ⚠️ POTENTIALLY INSUFFICIENT - May be too tight for body text */
|
|
222
|
+
.compact-body {
|
|
223
|
+
line-height: var(--slds-g-font-lineheight-1); /* 1.25 - OK for headings, not body */
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Font Sizes
|
|
230
|
+
|
|
231
|
+
### Available Hook
|
|
232
|
+
|
|
233
|
+
Only one font size hook exists in the SLDS system:
|
|
234
|
+
|
|
235
|
+
- **`--slds-g-font-size-base`** - Base font size for body text (typically 1rem / 16px)
|
|
236
|
+
|
|
237
|
+
### Current Best Practice
|
|
238
|
+
|
|
239
|
+
**Since no numbered font-size hooks exist, use rem values directly:**
|
|
240
|
+
|
|
241
|
+
```css
|
|
242
|
+
.heading {
|
|
243
|
+
font-size: 1.5rem; /* 24px for H3 level headings */
|
|
244
|
+
font-weight: var(--slds-g-font-weight-7);
|
|
245
|
+
line-height: var(--slds-g-font-lineheight-2);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.body-text {
|
|
249
|
+
font-size: var(--slds-g-font-size-base); /* Use the available hook */
|
|
250
|
+
font-weight: var(--slds-g-font-weight-4);
|
|
251
|
+
line-height: var(--slds-g-font-lineheight-3);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.caption {
|
|
255
|
+
font-size: 0.75rem; /* 12px for small text */
|
|
256
|
+
font-weight: var(--slds-g-font-weight-4);
|
|
257
|
+
line-height: var(--slds-g-font-lineheight-3);
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Recommended Size Scale
|
|
262
|
+
|
|
263
|
+
Use these rem values for consistent typography:
|
|
264
|
+
|
|
265
|
+
| Purpose | Size (rem) | Pixels @ 16px base |
|
|
266
|
+
| ----------------------- | ---------- | ------------------ |
|
|
267
|
+
| Tiny text, metadata | 0.625rem | 10px |
|
|
268
|
+
| Small text, captions | 0.75rem | 12px |
|
|
269
|
+
| Body text (most common) | 0.875rem | 14px |
|
|
270
|
+
| Base / Large body | 1rem | 16px |
|
|
271
|
+
| Small headings | 1.125rem | 18px |
|
|
272
|
+
| Subheadings | 1.25rem | 20px |
|
|
273
|
+
| H3 headings | 1.5rem | 24px |
|
|
274
|
+
| H2 headings | 1.75rem | 28px |
|
|
275
|
+
| H1 headings | 2rem | 32px |
|
|
276
|
+
| Large headings | 2.5rem | 40px |
|
|
277
|
+
| Hero text | 3rem | 48px |
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Typography Hierarchy Patterns
|
|
282
|
+
|
|
283
|
+
### Pattern 1: Standard Heading Hierarchy
|
|
284
|
+
|
|
285
|
+
```css
|
|
286
|
+
.heading-1 {
|
|
287
|
+
font-family: var(--slds-g-font-family-base);
|
|
288
|
+
font-size: 2rem; /* Large */
|
|
289
|
+
font-weight: var(--slds-g-font-weight-7); /* Bold */
|
|
290
|
+
line-height: var(--slds-g-font-lineheight-1); /* Tight */
|
|
291
|
+
color: var(--slds-g-color-palette-neutral-10);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.heading-2 {
|
|
295
|
+
font-size: 1.5rem; /* Medium-large */
|
|
296
|
+
font-weight: var(--slds-g-font-weight-7); /* Bold */
|
|
297
|
+
line-height: var(--slds-g-font-lineheight-2); /* Compact */
|
|
298
|
+
color: var(--slds-g-color-palette-neutral-10);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.heading-3 {
|
|
302
|
+
font-size: 1.25rem; /* Medium */
|
|
303
|
+
font-weight: var(--slds-g-font-weight-6); /* Semi-bold */
|
|
304
|
+
line-height: var(--slds-g-font-lineheight-2); /* Compact */
|
|
305
|
+
color: var(--slds-g-color-palette-neutral-20);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.heading-4 {
|
|
309
|
+
font-size: 1rem; /* Standard */
|
|
310
|
+
font-weight: var(--slds-g-font-weight-6); /* Semi-bold */
|
|
311
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
312
|
+
color: var(--slds-g-color-palette-neutral-20);
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
### Pattern 2: Body Text Variants
|
|
317
|
+
|
|
318
|
+
```css
|
|
319
|
+
.body-text-large {
|
|
320
|
+
font-family: var(--slds-g-font-family-base);
|
|
321
|
+
font-size: 1rem; /* 16px */
|
|
322
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
323
|
+
line-height: var(--slds-g-font-lineheight-4); /* Generous */
|
|
324
|
+
color: var(--slds-g-color-palette-neutral-20);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.body-text-standard {
|
|
328
|
+
font-size: 0.875rem; /* 14px - most common */
|
|
329
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
330
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
331
|
+
color: var(--slds-g-color-palette-neutral-20);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.body-text-small {
|
|
335
|
+
font-size: 0.75rem; /* 12px */
|
|
336
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
337
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
338
|
+
color: var(--slds-g-color-palette-neutral-30);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.caption {
|
|
342
|
+
font-size: 0.75rem; /* 12px */
|
|
343
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
344
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
345
|
+
color: var(--slds-g-color-palette-neutral-40); /* Lighter */
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Pattern 3: Interactive Text (Buttons, Links)
|
|
350
|
+
|
|
351
|
+
```css
|
|
352
|
+
.button-text {
|
|
353
|
+
font-family: var(--slds-g-font-family-base);
|
|
354
|
+
font-size: 0.875rem; /* 14px */
|
|
355
|
+
font-weight: var(--slds-g-font-weight-7); /* Bold - emphasizes action */
|
|
356
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
357
|
+
text-transform: none; /* Don't force uppercase */
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.link-text {
|
|
361
|
+
font-size: 0.875rem; /* 14px - matches body */
|
|
362
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular - same as body */
|
|
363
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
364
|
+
color: var(--slds-g-color-accent-2); /* Use accent color */
|
|
365
|
+
text-decoration: none;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.link-text:hover {
|
|
369
|
+
color: var(--slds-g-color-accent-3); /* Darker on hover */
|
|
370
|
+
text-decoration: underline;
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Pattern 4: Form Elements
|
|
375
|
+
|
|
376
|
+
```css
|
|
377
|
+
.label {
|
|
378
|
+
font-family: var(--slds-g-font-family-base);
|
|
379
|
+
font-size: 0.75rem; /* 12px - smaller than input */
|
|
380
|
+
font-weight: var(--slds-g-font-weight-6); /* Semi-bold - emphasis */
|
|
381
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
382
|
+
color: var(--slds-g-color-palette-neutral-20);
|
|
383
|
+
margin-bottom: var(--slds-g-spacing-2);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.input-text {
|
|
387
|
+
font-size: 0.875rem; /* 14px - readable */
|
|
388
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
389
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
390
|
+
color: var(--slds-g-color-palette-neutral-10);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.input-placeholder {
|
|
394
|
+
font-size: 0.875rem; /* Same as input */
|
|
395
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
396
|
+
color: var(--slds-g-color-palette-neutral-50); /* Lighter */
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.help-text {
|
|
400
|
+
font-size: 0.75rem; /* 12px - smaller */
|
|
401
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
402
|
+
line-height: var(--slds-g-font-lineheight-3); /* Standard */
|
|
403
|
+
color: var(--slds-g-color-palette-neutral-40); /* Light gray */
|
|
404
|
+
margin-top: var(--slds-g-spacing-1);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.error-text {
|
|
408
|
+
font-size: 0.75rem; /* 12px */
|
|
409
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
410
|
+
color: var(--slds-g-color-palette-pink-10); /* Error color */
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Pattern 5: Code and Technical Text
|
|
415
|
+
|
|
416
|
+
```css
|
|
417
|
+
.code-inline {
|
|
418
|
+
font-family: var(--slds-g-font-family-monospace);
|
|
419
|
+
font-size: 0.875rem; /* Slightly smaller than body */
|
|
420
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
421
|
+
background: var(--slds-g-color-palette-neutral-95);
|
|
422
|
+
padding: 0.125rem 0.25rem;
|
|
423
|
+
border-radius: 0.125rem;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.code-block {
|
|
427
|
+
font-family: var(--slds-g-font-family-monospace);
|
|
428
|
+
font-size: 0.875rem; /* 14px */
|
|
429
|
+
font-weight: var(--slds-g-font-weight-4); /* Regular */
|
|
430
|
+
line-height: var(--slds-g-font-lineheight-4); /* Generous for readability */
|
|
431
|
+
background: var(--slds-g-color-palette-neutral-95);
|
|
432
|
+
padding: var(--slds-g-spacing-4);
|
|
433
|
+
border-radius: 0.25rem;
|
|
434
|
+
color: var(--slds-g-color-palette-neutral-10);
|
|
435
|
+
}
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Accessibility Best Practices
|
|
441
|
+
|
|
442
|
+
### Text Size
|
|
443
|
+
|
|
444
|
+
**Minimum sizes:**
|
|
445
|
+
|
|
446
|
+
- Body text: 14px (0.875rem) or larger
|
|
447
|
+
- Small text: 12px (0.75rem) minimum
|
|
448
|
+
- Avoid text smaller than 12px
|
|
449
|
+
|
|
450
|
+
```css
|
|
451
|
+
/* ✅ ACCESSIBLE */
|
|
452
|
+
.body {
|
|
453
|
+
font-size: 0.875rem;
|
|
454
|
+
} /* 14px */
|
|
455
|
+
.caption {
|
|
456
|
+
font-size: 0.75rem;
|
|
457
|
+
} /* 12px - minimum */
|
|
458
|
+
|
|
459
|
+
/* ❌ TOO SMALL */
|
|
460
|
+
.tiny {
|
|
461
|
+
font-size: 0.625rem;
|
|
462
|
+
} /* 10px - avoid */
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### Line Height
|
|
466
|
+
|
|
467
|
+
**WCAG Recommendation:** Minimum 1.5 for body text
|
|
468
|
+
|
|
469
|
+
```css
|
|
470
|
+
/* ✅ MEETS WCAG */
|
|
471
|
+
.body-text {
|
|
472
|
+
line-height: var(--slds-g-font-lineheight-3); /* 1.5 */
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/* ⚠️ OK FOR HEADINGS, NOT BODY */
|
|
476
|
+
.heading {
|
|
477
|
+
line-height: var(--slds-g-font-lineheight-1); /* 1.25 - headings only */
|
|
478
|
+
}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Contrast
|
|
482
|
+
|
|
483
|
+
Combine typography with proper color contrast:
|
|
484
|
+
|
|
485
|
+
```css
|
|
486
|
+
/* ✅ GOOD CONTRAST - 50+ point separation */
|
|
487
|
+
.text-on-light {
|
|
488
|
+
color: var(--slds-g-color-palette-neutral-10); /* Dark text */
|
|
489
|
+
background: var(--slds-g-color-palette-neutral-95); /* Light background */
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/* ⚠️ INSUFFICIENT for body text */
|
|
493
|
+
.low-contrast-text {
|
|
494
|
+
color: var(--slds-g-color-palette-neutral-50); /* Mid gray */
|
|
495
|
+
background: var(--slds-g-color-palette-neutral-100); /* White */
|
|
496
|
+
/* Only 50-point separation = borderline */
|
|
497
|
+
}
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### Font Weight Considerations
|
|
501
|
+
|
|
502
|
+
- **Light weights (1-2):** Use only for large text (headings 24px+)
|
|
503
|
+
- **Regular weights (3-4):** Safe for all sizes
|
|
504
|
+
- **Bold weights (5-7):** Improves readability at small sizes
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## Density-Aware Typography
|
|
509
|
+
|
|
510
|
+
### Automatic Scaling
|
|
511
|
+
|
|
512
|
+
Some typography properties (especially line heights) may adapt to density settings automatically. Font sizes generally remain fixed.
|
|
513
|
+
|
|
514
|
+
```css
|
|
515
|
+
/* Typography that adapts to density */
|
|
516
|
+
.component-text {
|
|
517
|
+
font-size: 0.875rem; /* Usually fixed */
|
|
518
|
+
line-height: var(--slds-g-font-lineheight-3); /* May adapt */
|
|
519
|
+
/* Some implementations adjust line-height in compact mode */
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
### Best Practice
|
|
524
|
+
|
|
525
|
+
For most components, keep font sizes fixed and let spacing handle density:
|
|
526
|
+
|
|
527
|
+
```css
|
|
528
|
+
.button {
|
|
529
|
+
font-size: 0.875rem; /* Fixed */
|
|
530
|
+
font-weight: var(--slds-g-font-weight-7); /* Fixed */
|
|
531
|
+
line-height: var(--slds-g-font-lineheight-3); /* Fixed or adaptive */
|
|
532
|
+
padding: var(--slds-g-spacing-var-3); /* Adapts to density */
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
## Common Mistakes and Solutions
|
|
539
|
+
|
|
540
|
+
### Mistake 1: Using Named Weight Hooks
|
|
541
|
+
|
|
542
|
+
```css
|
|
543
|
+
/* ❌ WRONG - These don't exist */
|
|
544
|
+
.text {
|
|
545
|
+
font-weight: var(--slds-g-font-weight-bold);
|
|
546
|
+
font-weight: var(--slds-g-font-weight-semibold);
|
|
547
|
+
font-weight: var(--slds-g-font-weight-medium);
|
|
548
|
+
font-weight: var(--slds-g-font-weight-regular);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/* ✅ CORRECT - Use numbered hooks */
|
|
552
|
+
.text-bold {
|
|
553
|
+
font-weight: var(--slds-g-font-weight-7);
|
|
554
|
+
}
|
|
555
|
+
.text-semibold {
|
|
556
|
+
font-weight: var(--slds-g-font-weight-6);
|
|
557
|
+
}
|
|
558
|
+
.text-medium {
|
|
559
|
+
font-weight: var(--slds-g-font-weight-5);
|
|
560
|
+
}
|
|
561
|
+
.text-regular {
|
|
562
|
+
font-weight: var(--slds-g-font-weight-4);
|
|
563
|
+
}
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Mistake 2: Hard-Coding Font Values
|
|
567
|
+
|
|
568
|
+
```css
|
|
569
|
+
/* ❌ WRONG - Hard-coded values */
|
|
570
|
+
.text {
|
|
571
|
+
font-family: 'Salesforce Sans', Arial, sans-serif;
|
|
572
|
+
font-weight: 700;
|
|
573
|
+
line-height: 1.5;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/* ✅ CORRECT - Use typography hooks */
|
|
577
|
+
.text {
|
|
578
|
+
font-family: var(--slds-g-font-family-base);
|
|
579
|
+
font-weight: var(--slds-g-font-weight-7);
|
|
580
|
+
line-height: var(--slds-g-font-lineheight-3);
|
|
581
|
+
}
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### Mistake 3: Inconsistent Type Scale
|
|
585
|
+
|
|
586
|
+
```css
|
|
587
|
+
/* ❌ INCONSISTENT - Random sizes */
|
|
588
|
+
.heading-1 {
|
|
589
|
+
font-size: 2.3rem;
|
|
590
|
+
}
|
|
591
|
+
.heading-2 {
|
|
592
|
+
font-size: 1.7rem;
|
|
593
|
+
}
|
|
594
|
+
.heading-3 {
|
|
595
|
+
font-size: 1.4rem;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/* ✅ CONSISTENT - Following scale */
|
|
599
|
+
.heading-1 {
|
|
600
|
+
font-size: 2rem;
|
|
601
|
+
} /* 32px */
|
|
602
|
+
.heading-2 {
|
|
603
|
+
font-size: 1.5rem;
|
|
604
|
+
} /* 24px */
|
|
605
|
+
.heading-3 {
|
|
606
|
+
font-size: 1.25rem;
|
|
607
|
+
} /* 20px */
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
### Mistake 4: Poor Line Height for Text Size
|
|
611
|
+
|
|
612
|
+
```css
|
|
613
|
+
/* ❌ WRONG - Tight line height on body text */
|
|
614
|
+
.body-text {
|
|
615
|
+
font-size: 0.875rem;
|
|
616
|
+
line-height: var(--slds-g-font-lineheight-1); /* Too tight for body */
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/* ✅ CORRECT - Appropriate line height */
|
|
620
|
+
.body-text {
|
|
621
|
+
font-size: 0.875rem;
|
|
622
|
+
line-height: var(--slds-g-font-lineheight-3); /* 1.5 - good for reading */
|
|
623
|
+
}
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
---
|
|
627
|
+
|
|
628
|
+
## Summary for Coding Agents
|
|
629
|
+
|
|
630
|
+
### Quick Reference
|
|
631
|
+
|
|
632
|
+
**Font Families:**
|
|
633
|
+
|
|
634
|
+
- Default: `font-family-base`
|
|
635
|
+
- Code: `font-family-monospace`
|
|
636
|
+
|
|
637
|
+
**Font Weights (use numbers 1-7):**
|
|
638
|
+
|
|
639
|
+
- Light: `font-weight-1` or `font-weight-2` (300)
|
|
640
|
+
- Regular: `font-weight-3` or `font-weight-4` (400)
|
|
641
|
+
- Medium: `font-weight-5` (500)
|
|
642
|
+
- Semi-bold: `font-weight-6` (600)
|
|
643
|
+
- Bold: `font-weight-7` (700)
|
|
644
|
+
|
|
645
|
+
**Line Heights (use numbers 1-6):**
|
|
646
|
+
|
|
647
|
+
- Tight: `font-lineheight-1` (1.25) - headings only
|
|
648
|
+
- Standard: `font-lineheight-3` (1.5) - body text
|
|
649
|
+
- Generous: `font-lineheight-4` or higher - long-form content
|
|
650
|
+
|
|
651
|
+
**Font Sizes:**
|
|
652
|
+
|
|
653
|
+
- Currently: Use hard-coded rem values with comments
|
|
654
|
+
- Future: Check for `font-size-*` hooks with `{{EXPLORE_SLDS_STYLING_TOOL}}`
|
|
655
|
+
|
|
656
|
+
### Search for Hooks
|
|
657
|
+
|
|
658
|
+
```javascript
|
|
659
|
+
// Find all typography hooks
|
|
660
|
+
{
|
|
661
|
+
{
|
|
662
|
+
EXPLORE_SLDS_STYLING_TOOL;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
({ category: 'font' });
|
|
666
|
+
|
|
667
|
+
// Find font weights
|
|
668
|
+
{
|
|
669
|
+
{
|
|
670
|
+
EXPLORE_SLDS_STYLING_TOOL;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
({ prefix: '--slds-g-font-weight-' });
|
|
674
|
+
|
|
675
|
+
// Find line heights
|
|
676
|
+
{
|
|
677
|
+
{
|
|
678
|
+
EXPLORE_SLDS_STYLING_TOOL;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
({ search: 'lineheight' });
|
|
682
|
+
|
|
683
|
+
// Check specific hook
|
|
684
|
+
{
|
|
685
|
+
{
|
|
686
|
+
EXPLORE_SLDS_STYLING_TOOL;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
({ hooks: ['--slds-g-font-weight-7'] });
|
|
690
|
+
```
|
|
691
|
+
|
|
692
|
+
### Key Rules
|
|
693
|
+
|
|
694
|
+
1. ✅ Use numbered weight hooks (`font-weight-7`), not named (`font-weight-bold`)
|
|
695
|
+
2. ✅ Use `font-family-base` for most text
|
|
696
|
+
3. ✅ Use `font-family-monospace` for code only
|
|
697
|
+
4. ✅ Maintain minimum 1.5 line height for body text
|
|
698
|
+
5. ✅ Use font-size 14px (0.875rem) or larger for body text
|
|
699
|
+
6. ❌ Never hard-code fonts when hooks exist
|
|
700
|
+
7. ❌ Never use light weights (1-2) for small text
|
|
701
|
+
|
|
702
|
+
---
|
|
703
|
+
|
|
704
|
+
**References:**
|
|
705
|
+
|
|
706
|
+
- [Complete Hooks Index](../metadata/hooks-index.json)
|
|
707
|
+
- [Guidance Overview](../guidance.md)
|
|
708
|
+
- [SLDS Typography (when available)](https://www.lightningdesignsystem.com/)
|