@ceed/cds 1.24.1-next.3 → 1.25.0
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/chunks/rehype-accent-FZRUD7VI.js +39 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/components/DataTable/components.d.ts +2 -1
- package/dist/components/DataTable/styled.d.ts +3 -1
- package/dist/components/DataTable/types.d.ts +1 -0
- package/dist/components/RadioTileGroup/RadioTileGroup.d.ts +56 -0
- package/dist/components/RadioTileGroup/index.d.ts +3 -0
- package/dist/components/data-display/DataTable.md +77 -1
- package/dist/components/data-display/InfoSign.md +74 -91
- package/dist/components/data-display/Typography.md +411 -94
- package/dist/components/feedback/CircularProgress.md +257 -0
- package/dist/components/feedback/Dialog.md +76 -62
- package/dist/components/feedback/Modal.md +430 -138
- package/dist/components/feedback/Skeleton.md +280 -0
- package/dist/components/feedback/llms.txt +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/inputs/Autocomplete.md +356 -107
- package/dist/components/inputs/ButtonGroup.md +115 -104
- package/dist/components/inputs/CurrencyInput.md +183 -5
- package/dist/components/inputs/DatePicker.md +108 -431
- package/dist/components/inputs/DateRangePicker.md +131 -492
- package/dist/components/inputs/FilterableCheckboxGroup.md +145 -19
- package/dist/components/inputs/FormControl.md +361 -0
- package/dist/components/inputs/IconButton.md +137 -88
- package/dist/components/inputs/Input.md +204 -73
- package/dist/components/inputs/MonthPicker.md +95 -422
- package/dist/components/inputs/MonthRangePicker.md +89 -466
- package/dist/components/inputs/PercentageInput.md +185 -16
- package/dist/components/inputs/RadioButton.md +163 -35
- package/dist/components/inputs/RadioList.md +241 -0
- package/dist/components/inputs/RadioTileGroup.md +507 -0
- package/dist/components/inputs/Select.md +222 -326
- package/dist/components/inputs/Slider.md +334 -0
- package/dist/components/inputs/Switch.md +143 -376
- package/dist/components/inputs/Textarea.md +213 -10
- package/dist/components/inputs/Uploader/Uploader.md +145 -66
- package/dist/components/inputs/llms.txt +4 -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 +153 -328
- package/dist/guides/ThemeProvider.md +89 -0
- package/dist/guides/llms.txt +9 -0
- package/dist/index.browser.js +224 -0
- package/dist/index.browser.js.map +7 -0
- package/dist/index.cjs +648 -390
- package/dist/index.d.ts +1 -1
- package/dist/index.js +563 -361
- package/dist/llms.txt +9 -0
- package/framer/index.js +1 -163
- package/package.json +22 -17
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
Typography
|
|
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
|
+
|
|
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.
|
|
6
8
|
|
|
7
9
|
```tsx
|
|
8
10
|
<Typography children="Typography" />
|
|
@@ -21,10 +23,10 @@ import { Typography } from '@ceed/cds';
|
|
|
21
23
|
function MyComponent() {
|
|
22
24
|
return (
|
|
23
25
|
<div>
|
|
24
|
-
<Typography level="h1"
|
|
25
|
-
<Typography level="body-md"
|
|
26
|
+
<Typography level="h1">Main Heading</Typography>
|
|
27
|
+
<Typography level="body-md">This is body text.</Typography>
|
|
26
28
|
<Typography level="body-sm" color="neutral">
|
|
27
|
-
|
|
29
|
+
This is supporting description text.
|
|
28
30
|
</Typography>
|
|
29
31
|
</div>
|
|
30
32
|
);
|
|
@@ -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.
|
|
39
130
|
|
|
40
131
|
```tsx
|
|
41
|
-
|
|
42
|
-
<Typography level="
|
|
43
|
-
<Typography level="
|
|
44
|
-
<Typography level="
|
|
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
|
+
```
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<Typography level="h1">H1 - Main page heading</Typography>
|
|
142
|
+
<Typography level="h2">H2 - Section heading</Typography>
|
|
143
|
+
<Typography level="h3">H3 - Subsection heading</Typography>
|
|
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,13 +164,237 @@ function MyComponent() {
|
|
|
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
|
+
```
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
<Typography level="body-lg">Large body text</Typography>
|
|
180
|
+
<Typography level="body-md">Regular body text</Typography>
|
|
181
|
+
<Typography level="body-sm">Small body text</Typography>
|
|
182
|
+
<Typography level="body-xs">Extra small text</Typography>
|
|
183
|
+
```
|
|
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
|
+
```
|
|
60
372
|
|
|
61
373
|
```tsx
|
|
62
|
-
<Typography
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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>
|
|
66
398
|
```
|
|
67
399
|
|
|
68
400
|
## Common Use Cases
|
|
@@ -74,22 +406,25 @@ function ArticlePage() {
|
|
|
74
406
|
return (
|
|
75
407
|
<article>
|
|
76
408
|
<Typography level="h1" sx={{ mb: 2 }}>
|
|
77
|
-
|
|
409
|
+
Article Title
|
|
78
410
|
</Typography>
|
|
79
411
|
|
|
80
412
|
<Typography level="body-sm" color="neutral" sx={{ mb: 3 }}>
|
|
81
|
-
|
|
413
|
+
January 15, 2024 · Written by John Doe
|
|
82
414
|
</Typography>
|
|
83
415
|
|
|
84
416
|
<Typography level="body-md" sx={{ mb: 2 }}>
|
|
85
|
-
|
|
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
|
}
|
|
@@ -101,15 +436,15 @@ function ArticlePage() {
|
|
|
101
436
|
<Card>
|
|
102
437
|
<CardContent>
|
|
103
438
|
<Typography level="title-md" sx={{ mb: 1 }}>
|
|
104
|
-
|
|
439
|
+
Product Name
|
|
105
440
|
</Typography>
|
|
106
441
|
|
|
107
442
|
<Typography level="body-sm" color="neutral" sx={{ mb: 2 }}>
|
|
108
|
-
|
|
443
|
+
Category: Electronics
|
|
109
444
|
</Typography>
|
|
110
445
|
|
|
111
446
|
<Typography level="body-md" sx={{ mb: 2 }}>
|
|
112
|
-
|
|
447
|
+
A detailed description of the product goes here.
|
|
113
448
|
</Typography>
|
|
114
449
|
|
|
115
450
|
<Typography level="title-lg" color="primary">
|
|
@@ -125,41 +460,58 @@ function ArticlePage() {
|
|
|
125
460
|
<Stack spacing={2}>
|
|
126
461
|
<FormControl>
|
|
127
462
|
<Typography level="title-sm" component="label">
|
|
128
|
-
|
|
463
|
+
Username
|
|
129
464
|
</Typography>
|
|
130
|
-
<Input placeholder="
|
|
465
|
+
<Input placeholder="Enter your name" />
|
|
131
466
|
<Typography level="body-xs" color="neutral">
|
|
132
|
-
|
|
467
|
+
Please enter your real name.
|
|
133
468
|
</Typography>
|
|
134
469
|
</FormControl>
|
|
135
470
|
|
|
136
471
|
<FormControl error>
|
|
137
472
|
<Typography level="title-sm" component="label">
|
|
138
|
-
|
|
473
|
+
Email Address
|
|
139
474
|
</Typography>
|
|
140
475
|
<Input placeholder="email@example.com" />
|
|
141
476
|
<Typography level="body-xs" color="danger">
|
|
142
|
-
|
|
477
|
+
The email format is invalid.
|
|
143
478
|
</Typography>
|
|
144
479
|
</FormControl>
|
|
145
480
|
</Stack>
|
|
146
481
|
```
|
|
147
482
|
|
|
483
|
+
> 💡 **Tip: Use built-in form props instead**
|
|
484
|
+
>
|
|
485
|
+
> Input, Select, Textarea, DatePicker 등 Input 계열 컴포넌트는 `label`, `helperText` prop을 자체적으로 지원합니다.
|
|
486
|
+
> Form을 구성할 때는 Typography로 직접 label/helperText를 만드는 것보다 각 컴포넌트의 내장 prop을 사용하는 것이 권장됩니다.
|
|
487
|
+
>
|
|
488
|
+
> ```tsx
|
|
489
|
+
> // ✅ Recommended: 컴포넌트 내장 prop 사용
|
|
490
|
+
> <Input label="Username" helperText="Please enter your real name." />
|
|
491
|
+
>
|
|
492
|
+
> // ❌ Not recommended: Typography로 직접 구성
|
|
493
|
+
> <FormControl>
|
|
494
|
+
> <Typography level="title-sm" component="label">Username</Typography>
|
|
495
|
+
> <Input placeholder="Enter your name" />
|
|
496
|
+
> <Typography level="body-xs" color="neutral">Please enter your real name.</Typography>
|
|
497
|
+
> </FormControl>
|
|
498
|
+
> ```
|
|
499
|
+
|
|
148
500
|
### Status and Indicators
|
|
149
501
|
|
|
150
502
|
```tsx
|
|
151
503
|
<Stack spacing={2}>
|
|
152
504
|
<Box>
|
|
153
|
-
<Typography level="body-md"
|
|
505
|
+
<Typography level="body-md">Server Status:</Typography>
|
|
154
506
|
<Typography level="body-md" color="success">
|
|
155
|
-
|
|
507
|
+
Operating Normally
|
|
156
508
|
</Typography>
|
|
157
509
|
</Box>
|
|
158
510
|
|
|
159
511
|
<Box>
|
|
160
|
-
<Typography level="body-md"
|
|
512
|
+
<Typography level="body-md">Last Updated:</Typography>
|
|
161
513
|
<Typography level="body-sm" color="neutral">
|
|
162
|
-
2
|
|
514
|
+
2 minutes ago
|
|
163
515
|
</Typography>
|
|
164
516
|
</Box>
|
|
165
517
|
</Stack>
|
|
@@ -169,7 +521,7 @@ function ArticlePage() {
|
|
|
169
521
|
|
|
170
522
|
```tsx
|
|
171
523
|
<Stack spacing={1}>
|
|
172
|
-
<Typography level="title-md"
|
|
524
|
+
<Typography level="title-md">Todo List</Typography>
|
|
173
525
|
|
|
174
526
|
{todoItems.map((item) => (
|
|
175
527
|
<Box key={item.id} sx={{ pl: 2 }}>
|
|
@@ -190,79 +542,44 @@ function ArticlePage() {
|
|
|
190
542
|
</Stack>
|
|
191
543
|
```
|
|
192
544
|
|
|
193
|
-
##
|
|
194
|
-
|
|
195
|
-
Typography는 다양한 색상을 지원합니다:
|
|
196
|
-
|
|
197
|
-
```tsx
|
|
198
|
-
<Stack spacing={1}>
|
|
199
|
-
<Typography color="primary">Primary 색상</Typography>
|
|
200
|
-
<Typography color="neutral">Neutral 색상</Typography>
|
|
201
|
-
<Typography color="danger">Danger 색상</Typography>
|
|
202
|
-
<Typography color="success">Success 색상</Typography>
|
|
203
|
-
<Typography color="warning">Warning 색상</Typography>
|
|
204
|
-
</Stack>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
## Component Prop
|
|
545
|
+
## Best Practices
|
|
208
546
|
|
|
209
|
-
|
|
547
|
+
1. **Semantic Structure**: Use heading levels in order (`h1` → `h2` → `h3`) to create a clear document hierarchy.
|
|
210
548
|
|
|
211
549
|
```tsx
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
</Typography>
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</Typography>
|
|
219
|
-
|
|
220
|
-
<Typography level="title-md" component={Link} href="/page">
|
|
221
|
-
링크 컴포넌트로 렌더링
|
|
222
|
-
</Typography>
|
|
550
|
+
// ✅ Correct order
|
|
551
|
+
<Typography level="h1">Main heading</Typography>
|
|
552
|
+
<Typography level="h2">Section heading</Typography>
|
|
553
|
+
<Typography level="h3">Subsection</Typography>
|
|
554
|
+
|
|
555
|
+
// ❌ Incorrect order — skipping h2
|
|
556
|
+
<Typography level="h1">Main heading</Typography>
|
|
557
|
+
<Typography level="h3">Section heading</Typography>
|
|
223
558
|
```
|
|
224
559
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
반응형 레벨을 사용할 수 있습니다:
|
|
560
|
+
2. **Consistency**: Use the same level for text serving the same purpose across the application.
|
|
228
561
|
|
|
229
|
-
|
|
230
|
-
<Typography
|
|
231
|
-
level={{ xs: 'h3', sm: 'h2', md: 'h1' }}
|
|
232
|
-
sx={{
|
|
233
|
-
fontSize: { xs: '1.5rem', sm: '2rem', md: '2.5rem' },
|
|
234
|
-
}}
|
|
235
|
-
>
|
|
236
|
-
반응형 제목
|
|
237
|
-
</Typography>
|
|
238
|
-
```
|
|
562
|
+
3. **Readability**: Provide proper line spacing and paragraph separation for body text.
|
|
239
563
|
|
|
240
|
-
|
|
564
|
+
4. **Color Contrast**: Maintain sufficient color contrast to ensure accessibility.
|
|
241
565
|
|
|
242
|
-
|
|
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.
|
|
243
571
|
|
|
244
|
-
|
|
245
|
-
// ✅ 올바른 순서
|
|
246
|
-
<Typography level="h1">메인 제목</Typography>
|
|
247
|
-
<Typography level="h2">섹션 제목</Typography>
|
|
248
|
-
<Typography level="h3">하위 섹션</Typography>
|
|
249
|
-
|
|
250
|
-
// ❌ 잘못된 순서
|
|
251
|
-
<Typography level="h1">메인 제목</Typography>
|
|
252
|
-
<Typography level="h3">섹션 제목</Typography>
|
|
253
|
-
```
|
|
572
|
+
6. **Avoid inline style overrides**: Prefer the `level` prop over `sx` for font sizing. Use `level` for consistent design tokens.
|
|
254
573
|
|
|
255
|
-
|
|
574
|
+
7. **Use `textColor` for custom colors**: When the five semantic colors are insufficient, use `textColor` to apply any palette value directly.
|
|
256
575
|
|
|
257
|
-
|
|
576
|
+
8. **Use `body-xs` sparingly**: Reserve `body-xs` (12px) for auxiliary information such as timestamps, counters, and footnotes — not for primary content.
|
|
258
577
|
|
|
259
|
-
|
|
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.
|
|
260
579
|
|
|
261
580
|
## Accessibility
|
|
262
581
|
|
|
263
|
-
-
|
|
264
|
-
-
|
|
265
|
-
-
|
|
266
|
-
-
|
|
267
|
-
|
|
268
|
-
Typography는 사용자 인터페이스에서 정보를 효과적으로 전달하고 시각적 계층 구조를 만드는 데 핵심적인 역할을 합니다. 적절한 레벨과 스타일을 선택하여 읽기 쉽고 접근 가능한 콘텐츠를 만들 수 있습니다.
|
|
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).
|