@ceed/cds 1.22.3 → 1.22.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/dist/components/data-display/InfoSign.md +74 -91
- package/dist/components/data-display/Typography.md +363 -63
- package/dist/components/feedback/CircularProgress.md +257 -0
- package/dist/components/feedback/Skeleton.md +280 -0
- package/dist/components/feedback/llms.txt +2 -0
- package/dist/components/inputs/ButtonGroup.md +115 -104
- package/dist/components/inputs/CurrencyInput.md +181 -8
- package/dist/components/inputs/DatePicker.md +108 -436
- package/dist/components/inputs/DateRangePicker.md +130 -496
- package/dist/components/inputs/FilterableCheckboxGroup.md +141 -20
- package/dist/components/inputs/FormControl.md +368 -0
- package/dist/components/inputs/IconButton.md +137 -88
- package/dist/components/inputs/Input.md +203 -77
- package/dist/components/inputs/MonthPicker.md +95 -427
- package/dist/components/inputs/MonthRangePicker.md +89 -471
- package/dist/components/inputs/PercentageInput.md +183 -19
- package/dist/components/inputs/RadioButton.md +163 -35
- package/dist/components/inputs/RadioList.md +241 -0
- package/dist/components/inputs/RadioTileGroup.md +146 -62
- package/dist/components/inputs/Select.md +219 -328
- package/dist/components/inputs/Slider.md +334 -0
- package/dist/components/inputs/Switch.md +143 -376
- package/dist/components/inputs/Textarea.md +209 -11
- package/dist/components/inputs/Uploader/Uploader.md +145 -66
- package/dist/components/inputs/llms.txt +3 -0
- package/dist/components/navigation/Breadcrumbs.md +57 -308
- package/dist/components/navigation/Drawer.md +180 -0
- package/dist/components/navigation/Dropdown.md +98 -215
- package/dist/components/navigation/IconMenuButton.md +40 -502
- package/dist/components/navigation/InsetDrawer.md +281 -650
- package/dist/components/navigation/Link.md +31 -348
- package/dist/components/navigation/Menu.md +92 -285
- package/dist/components/navigation/MenuButton.md +55 -448
- package/dist/components/navigation/Pagination.md +47 -338
- package/dist/components/navigation/Stepper.md +160 -28
- package/dist/components/navigation/Tabs.md +57 -316
- package/dist/components/surfaces/Accordions.md +49 -804
- package/dist/components/surfaces/Card.md +97 -157
- package/dist/components/surfaces/Divider.md +83 -234
- package/dist/components/surfaces/Sheet.md +152 -327
- package/dist/guides/ThemeProvider.md +89 -0
- package/dist/guides/llms.txt +9 -0
- package/dist/llms.txt +8 -0
- package/package.json +1 -1
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
The Typography component is a core component for displaying text. It is based on Joy UI Typography and provides a variety of text levels and styles. You can apply consistent typography across all text elements such as headings, body text, and labels.
|
|
6
6
|
|
|
7
|
+
CDS extends the default typography system with **marketing levels** (`marketing-lg`, `marketing-md`, `marketing-sm`) for landing pages and promotional content, and uses **Poppins** as the display font family.
|
|
8
|
+
|
|
7
9
|
```tsx
|
|
8
10
|
<Typography children="Typography" />
|
|
9
11
|
```
|
|
@@ -16,7 +18,7 @@ The Typography component is a core component for displaying text. It is based on
|
|
|
16
18
|
## Usage
|
|
17
19
|
|
|
18
20
|
```tsx
|
|
19
|
-
import { Typography } from '@ceed/
|
|
21
|
+
import { Typography } from '@ceed/cds';
|
|
20
22
|
|
|
21
23
|
function MyComponent() {
|
|
22
24
|
return (
|
|
@@ -33,20 +35,126 @@ function MyComponent() {
|
|
|
33
35
|
|
|
34
36
|
## Typography Levels
|
|
35
37
|
|
|
38
|
+
### Overview
|
|
39
|
+
|
|
40
|
+
Typography levels are divided into four groups: **Headings**, **Titles**, **Body**, and **Marketing**. The default level is `body-md`.
|
|
41
|
+
|
|
42
|
+
- **Headings** (`h1`–`h4`): Used for page and section headings. Uses the display font family (Poppins).
|
|
43
|
+
- **Titles** (`title-lg`, `title-md`, `title-sm`): Used for UI labels, card titles, and emphasized text. Uses the body font family (Inter).
|
|
44
|
+
- **Body** (`body-lg`, `body-md`, `body-sm`, `body-xs`): Used for readable content and descriptions. Uses the body font family (Inter).
|
|
45
|
+
- **Marketing** (`marketing-lg`, `marketing-md`, `marketing-sm`): Used for landing pages, hero banners, and promotional content. Uses the display font family (Poppins).
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
<>
|
|
49
|
+
<Stack direction="row" spacing={2}>
|
|
50
|
+
<Typography level="h1">h1</Typography>
|
|
51
|
+
<Typography {...args} level="h1" />
|
|
52
|
+
</Stack>
|
|
53
|
+
<Stack direction="row" spacing={2}>
|
|
54
|
+
<Typography level="h2">h2</Typography>
|
|
55
|
+
<Typography {...args} level="h2" />
|
|
56
|
+
</Stack>
|
|
57
|
+
<Stack direction="row" spacing={2}>
|
|
58
|
+
<Typography level="h3">h3</Typography>
|
|
59
|
+
<Typography {...args} level="h3" />
|
|
60
|
+
</Stack>
|
|
61
|
+
<Stack direction="row" spacing={2}>
|
|
62
|
+
<Typography level="h4">h4</Typography>
|
|
63
|
+
<Typography {...args} level="h4" />
|
|
64
|
+
</Stack>
|
|
65
|
+
<Stack direction="row" spacing={2}>
|
|
66
|
+
<Typography level="title-lg">title-lg</Typography>
|
|
67
|
+
<Typography {...args} level="title-lg" />
|
|
68
|
+
</Stack>
|
|
69
|
+
<Stack direction="row" spacing={2}>
|
|
70
|
+
<Typography level="title-md">title-md</Typography>
|
|
71
|
+
<Typography {...args} level="title-md" />
|
|
72
|
+
</Stack>
|
|
73
|
+
<Stack direction="row" spacing={2}>
|
|
74
|
+
<Typography level="title-sm">title-sm</Typography>
|
|
75
|
+
<Typography {...args} level="title-sm" />
|
|
76
|
+
</Stack>
|
|
77
|
+
<Stack direction="row" spacing={2}>
|
|
78
|
+
<Typography level="body-lg">body-lg</Typography>
|
|
79
|
+
<Typography {...args} level="body-lg" />
|
|
80
|
+
</Stack>
|
|
81
|
+
<Stack direction="row" spacing={2}>
|
|
82
|
+
<Typography level="body-md">body-md</Typography>
|
|
83
|
+
<Typography {...args} level="body-md" />
|
|
84
|
+
</Stack>
|
|
85
|
+
<Stack direction="row" spacing={2}>
|
|
86
|
+
<Typography level="body-sm">body-sm</Typography>
|
|
87
|
+
<Typography {...args} level="body-sm" />
|
|
88
|
+
</Stack>
|
|
89
|
+
<Stack direction="row" spacing={2}>
|
|
90
|
+
<Typography level="body-xs">body-xs</Typography>
|
|
91
|
+
<Typography {...args} level="body-xs" />
|
|
92
|
+
</Stack>
|
|
93
|
+
<Stack direction="row" spacing={2}>
|
|
94
|
+
<Typography level="marketing-lg">marketing-lg</Typography>
|
|
95
|
+
<Typography {...args} level="marketing-lg" />
|
|
96
|
+
</Stack>
|
|
97
|
+
<Stack direction="row" spacing={2}>
|
|
98
|
+
<Typography level="marketing-md">marketing-md</Typography>
|
|
99
|
+
<Typography {...args} level="marketing-md" />
|
|
100
|
+
</Stack>
|
|
101
|
+
<Stack direction="row" spacing={2}>
|
|
102
|
+
<Typography level="marketing-sm">marketing-sm</Typography>
|
|
103
|
+
<Typography {...args} level="marketing-sm" />
|
|
104
|
+
</Stack>
|
|
105
|
+
</>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Style Reference
|
|
109
|
+
|
|
110
|
+
| Level | Font Family | Font Size | Font Weight | Line Height | Letter Spacing | Default Color | HTML Tag |
|
|
111
|
+
| ------------ | ----------------- | --------------- | -------------- | ----------- | -------------- | -------------- | -------- |
|
|
112
|
+
| h1 | display (Poppins) | 2.25rem (36px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h1>` |
|
|
113
|
+
| h2 | display (Poppins) | 1.875rem (30px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h2>` |
|
|
114
|
+
| h3 | display (Poppins) | 1.5rem (24px) | 600 (SemiBold) | 1.333 | -0.025em | text.primary | `<h3>` |
|
|
115
|
+
| h4 | display (Poppins) | 1.25rem (20px) | 600 (SemiBold) | 1.5 | -0.025em | text.primary | `<h4>` |
|
|
116
|
+
| title-lg | body (Inter) | 1.125rem (18px) | 600 (SemiBold) | 1.333 | - | text.primary | `<p>` |
|
|
117
|
+
| title-md | body (Inter) | 1rem (16px) | 500 (Medium) | 1.5 | - | text.primary | `<p>` |
|
|
118
|
+
| title-sm | body (Inter) | 0.875rem (14px) | 500 (Medium) | 1.429 | - | text.primary | `<p>` |
|
|
119
|
+
| body-lg | body (Inter) | 1.125rem (18px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
120
|
+
| body-md | body (Inter) | 1rem (16px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
121
|
+
| body-sm | body (Inter) | 0.875rem (14px) | inherit | 1.5 | - | text.tertiary | `<p>` |
|
|
122
|
+
| body-xs | body (Inter) | 0.75rem (12px) | 500 (Medium) | 1.5 | - | text.tertiary | `<span>` |
|
|
123
|
+
| marketing-lg | display (Poppins) | 2.625rem (42px) | 600 (SemiBold) | 1.333 | -0.025em | text.primary | `<div>` |
|
|
124
|
+
| marketing-md | display (Poppins) | 2rem (32px) | 600 (SemiBold) | 1.333 | -0.025em | text.primary | `<div>` |
|
|
125
|
+
| marketing-sm | display (Poppins) | 1.5rem (24px) | 500 (Medium) | 1.333 | -0.025em | text.primary | `<div>` |
|
|
126
|
+
|
|
36
127
|
### Headings
|
|
37
128
|
|
|
38
|
-
|
|
129
|
+
Heading levels define page structure and hierarchy. In CDS, they use the **Poppins** display font family with heavier weights for visual prominence.
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
<>
|
|
133
|
+
<Typography level="h1">h1 - Main page heading</Typography>
|
|
134
|
+
<Typography level="h2">h2 - Section heading</Typography>
|
|
135
|
+
<Typography level="h3">h3 - Subsection heading</Typography>
|
|
136
|
+
<Typography level="h4">h4 - Detail heading</Typography>
|
|
137
|
+
</>
|
|
138
|
+
```
|
|
39
139
|
|
|
40
140
|
```tsx
|
|
41
141
|
<Typography level="h1">H1 - Main page heading</Typography>
|
|
42
142
|
<Typography level="h2">H2 - Section heading</Typography>
|
|
43
143
|
<Typography level="h3">H3 - Subsection heading</Typography>
|
|
44
|
-
<Typography level="h4">H4 -
|
|
144
|
+
<Typography level="h4">H4 - Detail heading</Typography>
|
|
45
145
|
```
|
|
46
146
|
|
|
47
147
|
### Titles
|
|
48
148
|
|
|
49
|
-
|
|
149
|
+
Title levels are used for UI labels, card titles, and other emphasized text that is not a document heading.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
<>
|
|
153
|
+
<Typography level="title-lg">title-lg - Large title</Typography>
|
|
154
|
+
<Typography level="title-md">title-md - Medium title</Typography>
|
|
155
|
+
<Typography level="title-sm">title-sm - Small title</Typography>
|
|
156
|
+
</>
|
|
157
|
+
```
|
|
50
158
|
|
|
51
159
|
```tsx
|
|
52
160
|
<Typography level="title-lg">Large Title</Typography>
|
|
@@ -56,7 +164,16 @@ Used for important titles or emphasized text.
|
|
|
56
164
|
|
|
57
165
|
### Body Text
|
|
58
166
|
|
|
59
|
-
|
|
167
|
+
Body levels are used for readable content and descriptions. The default level `body-md` is suitable for most body text. Use `body-xs` sparingly for auxiliary information like timestamps or counters.
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
<>
|
|
171
|
+
<Typography level="body-lg">body-lg - Large body text</Typography>
|
|
172
|
+
<Typography level="body-md">body-md - Regular body text</Typography>
|
|
173
|
+
<Typography level="body-sm">body-sm - Small body text</Typography>
|
|
174
|
+
<Typography level="body-xs">body-xs - Extra small text</Typography>
|
|
175
|
+
</>
|
|
176
|
+
```
|
|
60
177
|
|
|
61
178
|
```tsx
|
|
62
179
|
<Typography level="body-lg">Large body text</Typography>
|
|
@@ -65,6 +182,221 @@ Levels for body text. Use these for most readable content.
|
|
|
65
182
|
<Typography level="body-xs">Extra small text</Typography>
|
|
66
183
|
```
|
|
67
184
|
|
|
185
|
+
### Marketing Levels
|
|
186
|
+
|
|
187
|
+
Marketing levels are designed for landing pages, hero banners, and promotional content. They use the **Poppins** display font family for a distinctive marketing look.
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<>
|
|
191
|
+
<Typography level="marketing-lg">
|
|
192
|
+
marketing-lg - Large marketing text
|
|
193
|
+
</Typography>
|
|
194
|
+
<Typography level="marketing-md">
|
|
195
|
+
marketing-md - Medium marketing text
|
|
196
|
+
</Typography>
|
|
197
|
+
<Typography level="marketing-sm">
|
|
198
|
+
marketing-sm - Small marketing text
|
|
199
|
+
</Typography>
|
|
200
|
+
</>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
<Typography level="marketing-lg">Large marketing text</Typography>
|
|
205
|
+
<Typography level="marketing-md">Medium marketing text</Typography>
|
|
206
|
+
<Typography level="marketing-sm">Small marketing text</Typography>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Design Token Reference
|
|
210
|
+
|
|
211
|
+
### Font Size Scale
|
|
212
|
+
|
|
213
|
+
| Token | Value |
|
|
214
|
+
| ----- | --------------- |
|
|
215
|
+
| xs | 0.75rem (12px) |
|
|
216
|
+
| sm | 0.875rem (14px) |
|
|
217
|
+
| md | 1rem (16px) |
|
|
218
|
+
| lg | 1.125rem (18px) |
|
|
219
|
+
| xl | 1.25rem (20px) |
|
|
220
|
+
| xl2 | 1.5rem (24px) |
|
|
221
|
+
| xl3 | 1.875rem (30px) |
|
|
222
|
+
| xl4 | 2.25rem (36px) |
|
|
223
|
+
|
|
224
|
+
### Font Weight Scale
|
|
225
|
+
|
|
226
|
+
| Token | Value |
|
|
227
|
+
| ----- | -------------- |
|
|
228
|
+
| sm | 300 (Light) |
|
|
229
|
+
| md | 500 (Medium) |
|
|
230
|
+
| lg | 600 (SemiBold) |
|
|
231
|
+
| xl | 700 (Bold) |
|
|
232
|
+
|
|
233
|
+
### Line Height Scale
|
|
234
|
+
|
|
235
|
+
| Token | Value |
|
|
236
|
+
| ----- | ----- |
|
|
237
|
+
| xs | 1.333 |
|
|
238
|
+
| sm | 1.429 |
|
|
239
|
+
| md | 1.5 |
|
|
240
|
+
| lg | 1.556 |
|
|
241
|
+
| xl | 1.667 |
|
|
242
|
+
|
|
243
|
+
### Font Families
|
|
244
|
+
|
|
245
|
+
- **body**: `"Inter"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
246
|
+
- **display**: `"Poppins"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
247
|
+
- **code**: `"Source Code Pro"`, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
|
|
248
|
+
|
|
249
|
+
## Colors
|
|
250
|
+
|
|
251
|
+
Typography supports five semantic colors via the `color` prop. Use `textColor` to apply any palette color directly.
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
<>
|
|
255
|
+
<Typography color="primary">Primary color</Typography>
|
|
256
|
+
<Typography color="neutral">Neutral color</Typography>
|
|
257
|
+
<Typography color="danger">Danger color</Typography>
|
|
258
|
+
<Typography color="success">Success color</Typography>
|
|
259
|
+
<Typography color="warning">Warning color</Typography>
|
|
260
|
+
</>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
<Typography color="primary">Primary color</Typography>
|
|
265
|
+
<Typography color="neutral">Neutral color</Typography>
|
|
266
|
+
<Typography color="danger">Danger color</Typography>
|
|
267
|
+
<Typography color="success">Success color</Typography>
|
|
268
|
+
<Typography color="warning">Warning color</Typography>
|
|
269
|
+
|
|
270
|
+
{/* Use textColor for specific palette values */}
|
|
271
|
+
<Typography textColor="neutral.600">Custom palette color</Typography>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Component Prop
|
|
275
|
+
|
|
276
|
+
Use the `component` prop to render Typography as a different HTML element or React component. Each level has a default HTML tag mapping shown below.
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
<>
|
|
280
|
+
<Typography level="h1" component="h2">
|
|
281
|
+
h1 style rendered as h2 tag
|
|
282
|
+
</Typography>
|
|
283
|
+
<Typography level="body-md" component="span">
|
|
284
|
+
body-md rendered as span
|
|
285
|
+
</Typography>
|
|
286
|
+
<Typography level="title-md" component="label">
|
|
287
|
+
title-md rendered as label
|
|
288
|
+
</Typography>
|
|
289
|
+
</>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
```tsx
|
|
293
|
+
<Typography level="h1" component="h2">
|
|
294
|
+
h1 style rendered as an h2 tag
|
|
295
|
+
</Typography>
|
|
296
|
+
|
|
297
|
+
<Typography level="body-md" component="span">
|
|
298
|
+
Inline text
|
|
299
|
+
</Typography>
|
|
300
|
+
|
|
301
|
+
<Typography level="title-md" component="label">
|
|
302
|
+
Rendered as a label element
|
|
303
|
+
</Typography>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Default HTML tag mapping:**
|
|
307
|
+
|
|
308
|
+
| Level | Default HTML Tag |
|
|
309
|
+
| ------------ | ---------------- |
|
|
310
|
+
| h1 | `<h1>` |
|
|
311
|
+
| h2 | `<h2>` |
|
|
312
|
+
| h3 | `<h3>` |
|
|
313
|
+
| h4 | `<h4>` |
|
|
314
|
+
| title-lg | `<p>` |
|
|
315
|
+
| title-md | `<p>` |
|
|
316
|
+
| title-sm | `<p>` |
|
|
317
|
+
| body-lg | `<p>` |
|
|
318
|
+
| body-md | `<p>` |
|
|
319
|
+
| body-sm | `<p>` |
|
|
320
|
+
| body-xs | `<span>` |
|
|
321
|
+
| marketing-lg | `<div>` |
|
|
322
|
+
| marketing-md | `<div>` |
|
|
323
|
+
| marketing-sm | `<div>` |
|
|
324
|
+
|
|
325
|
+
## Decorators
|
|
326
|
+
|
|
327
|
+
Use `startDecorator` and `endDecorator` to add icons or other elements before or after the text.
|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
<>
|
|
331
|
+
<Typography startDecorator={<InfoOutlined />}>
|
|
332
|
+
Text with start decorator
|
|
333
|
+
</Typography>
|
|
334
|
+
<Typography endDecorator={<ArrowForward />}>
|
|
335
|
+
Text with end decorator
|
|
336
|
+
</Typography>
|
|
337
|
+
<Typography startDecorator={<InfoOutlined />} endDecorator={<ArrowForward />}>
|
|
338
|
+
Text with both decorators
|
|
339
|
+
</Typography>
|
|
340
|
+
</>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
```tsx
|
|
344
|
+
import InfoOutlined from '@mui/icons-material/InfoOutlined';
|
|
345
|
+
import ArrowForward from '@mui/icons-material/ArrowForward';
|
|
346
|
+
|
|
347
|
+
<Typography startDecorator={<InfoOutlined />}>
|
|
348
|
+
Text with start decorator
|
|
349
|
+
</Typography>
|
|
350
|
+
|
|
351
|
+
<Typography endDecorator={<ArrowForward />}>
|
|
352
|
+
Text with end decorator
|
|
353
|
+
</Typography>
|
|
354
|
+
|
|
355
|
+
<Typography startDecorator={<InfoOutlined />} endDecorator={<ArrowForward />}>
|
|
356
|
+
Text with both decorators
|
|
357
|
+
</Typography>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
## Text Overflow (noWrap)
|
|
361
|
+
|
|
362
|
+
Use the `noWrap` prop to truncate overflowing text with an ellipsis. Pair it with a `maxWidth` to constrain the text width.
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
<Typography noWrap sx={{
|
|
366
|
+
maxWidth: 200
|
|
367
|
+
}}>
|
|
368
|
+
This is a long text that will be truncated with an ellipsis when it
|
|
369
|
+
exceeds the maximum width of the container.
|
|
370
|
+
</Typography>
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
<Typography noWrap sx={{ maxWidth: 200 }}>
|
|
375
|
+
This is a long text that will be truncated with an ellipsis when it exceeds
|
|
376
|
+
the maximum width.
|
|
377
|
+
</Typography>
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
## Responsive Typography
|
|
381
|
+
|
|
382
|
+
You can pass a responsive object to the `level` prop, or use `sx` to set responsive font sizes.
|
|
383
|
+
|
|
384
|
+
```tsx
|
|
385
|
+
{/* Responsive level */}
|
|
386
|
+
<Typography level={{ xs: 'h3', sm: 'h2', md: 'h1' }}>
|
|
387
|
+
Responsive Heading
|
|
388
|
+
</Typography>
|
|
389
|
+
|
|
390
|
+
{/* Responsive font size via sx */}
|
|
391
|
+
<Typography
|
|
392
|
+
sx={{
|
|
393
|
+
fontSize: { xs: '1rem', sm: '1.25rem', md: '1.5rem' },
|
|
394
|
+
}}
|
|
395
|
+
>
|
|
396
|
+
Responsive text
|
|
397
|
+
</Typography>
|
|
398
|
+
```
|
|
399
|
+
|
|
68
400
|
## Common Use Cases
|
|
69
401
|
|
|
70
402
|
### Page Structure
|
|
@@ -82,14 +414,17 @@ function ArticlePage() {
|
|
|
82
414
|
</Typography>
|
|
83
415
|
|
|
84
416
|
<Typography level="body-md" sx={{ mb: 2 }}>
|
|
85
|
-
The main content of the article goes here. This text uses a readable size
|
|
417
|
+
The main content of the article goes here. This text uses a readable size
|
|
418
|
+
and line spacing.
|
|
86
419
|
</Typography>
|
|
87
420
|
|
|
88
421
|
<Typography level="h2" sx={{ mt: 4, mb: 2 }}>
|
|
89
422
|
Section Title
|
|
90
423
|
</Typography>
|
|
91
424
|
|
|
92
|
-
<Typography level="body-md">
|
|
425
|
+
<Typography level="body-md">
|
|
426
|
+
The section content continues here.
|
|
427
|
+
</Typography>
|
|
93
428
|
</article>
|
|
94
429
|
);
|
|
95
430
|
}
|
|
@@ -207,56 +542,9 @@ function ArticlePage() {
|
|
|
207
542
|
</Stack>
|
|
208
543
|
```
|
|
209
544
|
|
|
210
|
-
## Colors
|
|
211
|
-
|
|
212
|
-
Typography supports various colors:
|
|
213
|
-
|
|
214
|
-
```tsx
|
|
215
|
-
<Stack spacing={1}>
|
|
216
|
-
<Typography color="primary">Primary color</Typography>
|
|
217
|
-
<Typography color="neutral">Neutral color</Typography>
|
|
218
|
-
<Typography color="danger">Danger color</Typography>
|
|
219
|
-
<Typography color="success">Success color</Typography>
|
|
220
|
-
<Typography color="warning">Warning color</Typography>
|
|
221
|
-
</Stack>
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
## Component Prop
|
|
225
|
-
|
|
226
|
-
You can render it as a different HTML element or React component:
|
|
227
|
-
|
|
228
|
-
```tsx
|
|
229
|
-
<Typography level="h1" component="h2">
|
|
230
|
-
h1 style rendered as an h2 tag
|
|
231
|
-
</Typography>
|
|
232
|
-
|
|
233
|
-
<Typography level="body-md" component="span">
|
|
234
|
-
Inline text
|
|
235
|
-
</Typography>
|
|
236
|
-
|
|
237
|
-
<Typography level="title-md" component={Link} href="/page">
|
|
238
|
-
Rendered as a Link component
|
|
239
|
-
</Typography>
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
## Responsive Typography
|
|
243
|
-
|
|
244
|
-
You can use responsive levels:
|
|
245
|
-
|
|
246
|
-
```tsx
|
|
247
|
-
<Typography
|
|
248
|
-
level={{ xs: 'h3', sm: 'h2', md: 'h1' }}
|
|
249
|
-
sx={{
|
|
250
|
-
fontSize: { xs: '1.5rem', sm: '2rem', md: '2.5rem' },
|
|
251
|
-
}}
|
|
252
|
-
>
|
|
253
|
-
Responsive Heading
|
|
254
|
-
</Typography>
|
|
255
|
-
```
|
|
256
|
-
|
|
257
545
|
## Best Practices
|
|
258
546
|
|
|
259
|
-
1. **Semantic Structure**: Use heading levels in order to create a clear document
|
|
547
|
+
1. **Semantic Structure**: Use heading levels in order (`h1` → `h2` → `h3`) to create a clear document hierarchy.
|
|
260
548
|
|
|
261
549
|
```tsx
|
|
262
550
|
// ✅ Correct order
|
|
@@ -264,22 +552,34 @@ You can use responsive levels:
|
|
|
264
552
|
<Typography level="h2">Section heading</Typography>
|
|
265
553
|
<Typography level="h3">Subsection</Typography>
|
|
266
554
|
|
|
267
|
-
// ❌ Incorrect order
|
|
555
|
+
// ❌ Incorrect order — skipping h2
|
|
268
556
|
<Typography level="h1">Main heading</Typography>
|
|
269
557
|
<Typography level="h3">Section heading</Typography>
|
|
270
558
|
```
|
|
271
559
|
|
|
272
|
-
2. **Consistency**: Use the same level for text serving the same purpose.
|
|
560
|
+
2. **Consistency**: Use the same level for text serving the same purpose across the application.
|
|
273
561
|
|
|
274
562
|
3. **Readability**: Provide proper line spacing and paragraph separation for body text.
|
|
275
563
|
|
|
276
564
|
4. **Color Contrast**: Maintain sufficient color contrast to ensure accessibility.
|
|
277
565
|
|
|
278
|
-
|
|
566
|
+
5. **Level Selection Guide**:
|
|
567
|
+
- **Headings** (`h1`–`h4`): Use for document structure and section titles.
|
|
568
|
+
- **Titles** (`title-lg/md/sm`): Use for UI labels, card headers, and emphasized text.
|
|
569
|
+
- **Body** (`body-lg/md/sm/xs`): Use for content, descriptions, and supporting text.
|
|
570
|
+
- **Marketing** (`marketing-lg/md/sm`): Use exclusively for marketing and landing pages — not for general UI.
|
|
571
|
+
|
|
572
|
+
6. **Avoid inline style overrides**: Prefer the `level` prop over `sx` for font sizing. Use `level` for consistent design tokens.
|
|
279
573
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
-
|
|
283
|
-
|
|
574
|
+
7. **Use `textColor` for custom colors**: When the five semantic colors are insufficient, use `textColor` to apply any palette value directly.
|
|
575
|
+
|
|
576
|
+
8. **Use `body-xs` sparingly**: Reserve `body-xs` (12px) for auxiliary information such as timestamps, counters, and footnotes — not for primary content.
|
|
577
|
+
|
|
578
|
+
9. **Marketing vs Heading levels**: Marketing levels are intended for landing pages and promotional content only. For standard application UI, use heading and title levels instead. Be aware that `h1`–`h4` and `marketing-*` levels use the Poppins display font, while `title-*` and `body-*` use Inter.
|
|
579
|
+
|
|
580
|
+
## Accessibility
|
|
284
581
|
|
|
285
|
-
|
|
582
|
+
- Use sequential heading levels (`h1` → `h2` → `h3`). Do not skip levels.
|
|
583
|
+
- Use the `component` prop to separate visual style from semantic meaning (e.g., `level="h1" component="h2"` when you need h1 styling but h2 semantics).
|
|
584
|
+
- Avoid using `body-xs` (12px) for essential content — the small size may be difficult to read.
|
|
585
|
+
- Maintain sufficient color contrast ratios (WCAG AA: 4.5:1 for normal text, 3:1 for large text).
|