@ceed/ads 1.25.1-next.3 → 1.27.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/hooks.d.ts +1 -1
- package/dist/components/DataTable/styled.d.ts +3 -1
- package/dist/components/DataTable/types.d.ts +11 -0
- package/dist/components/DataTable/utils.d.ts +2 -2
- package/dist/components/ProfileMenu/ProfileMenu.d.ts +1 -1
- package/dist/components/data-display/Badge.md +71 -39
- package/dist/components/data-display/DataTable.md +177 -1
- package/dist/components/data-display/InfoSign.md +74 -98
- package/dist/components/data-display/Typography.md +363 -97
- package/dist/components/feedback/CircularProgress.md +257 -0
- package/dist/components/feedback/Dialog.md +76 -62
- package/dist/components/feedback/Modal.md +259 -44
- package/dist/components/feedback/Skeleton.md +280 -0
- package/dist/components/feedback/llms.txt +2 -0
- package/dist/components/inputs/Autocomplete.md +356 -107
- package/dist/components/inputs/ButtonGroup.md +115 -106
- package/dist/components/inputs/Calendar.md +98 -459
- 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/FilterMenu.md +169 -19
- package/dist/components/inputs/FilterableCheckboxGroup.md +123 -23
- package/dist/components/inputs/FormControl.md +361 -0
- package/dist/components/inputs/IconButton.md +137 -88
- package/dist/components/inputs/Input.md +5 -0
- 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 +150 -61
- package/dist/components/inputs/Select.md +222 -326
- package/dist/components/inputs/Slider.md +334 -0
- package/dist/components/inputs/Switch.md +136 -376
- package/dist/components/inputs/Textarea.md +213 -10
- package/dist/components/inputs/Uploader/Uploader.md +145 -66
- package/dist/components/inputs/llms.txt +3 -0
- package/dist/components/navigation/Breadcrumbs.md +80 -322
- package/dist/components/navigation/Dropdown.md +92 -221
- package/dist/components/navigation/IconMenuButton.md +40 -502
- package/dist/components/navigation/InsetDrawer.md +68 -738
- package/dist/components/navigation/Link.md +39 -298
- 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/ProfileMenu.md +45 -268
- package/dist/components/navigation/Stepper.md +160 -28
- package/dist/components/navigation/Tabs.md +57 -316
- package/dist/components/surfaces/Sheet.md +151 -334
- package/dist/guides/ThemeProvider.md +116 -0
- package/dist/guides/llms.txt +9 -0
- package/dist/index.browser.js +16 -18
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +381 -244
- package/dist/index.js +459 -378
- package/dist/llms.txt +8 -0
- package/framer/index.js +1 -166
- package/package.json +15 -16
|
@@ -2,7 +2,7 @@
|
|
|
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
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Typography children="Typography" />
|
|
@@ -21,10 +21,10 @@ import { Typography } from '@ceed/ads';
|
|
|
21
21
|
function MyComponent() {
|
|
22
22
|
return (
|
|
23
23
|
<div>
|
|
24
|
-
<Typography level="h1"
|
|
25
|
-
<Typography level="body-md"
|
|
24
|
+
<Typography level="h1">Main Heading</Typography>
|
|
25
|
+
<Typography level="body-md">This is body text.</Typography>
|
|
26
26
|
<Typography level="body-sm" color="neutral">
|
|
27
|
-
|
|
27
|
+
This is supporting description text.
|
|
28
28
|
</Typography>
|
|
29
29
|
</div>
|
|
30
30
|
);
|
|
@@ -33,20 +33,110 @@ function MyComponent() {
|
|
|
33
33
|
|
|
34
34
|
## Typography Levels
|
|
35
35
|
|
|
36
|
+
### Overview
|
|
37
|
+
|
|
38
|
+
Typography levels are divided into three groups: **Headings**, **Titles**, and **Body**. The default level is `body-md`.
|
|
39
|
+
|
|
40
|
+
- **Headings** (`h1`–`h4`): Used for page and section headings. Uses the display font family (Inter).
|
|
41
|
+
- **Titles** (`title-lg`, `title-md`, `title-sm`): Used for UI labels, card titles, and emphasized text. Uses the body font family (Inter).
|
|
42
|
+
- **Body** (`body-lg`, `body-md`, `body-sm`, `body-xs`): Used for readable content and descriptions. Uses the body font family (Inter).
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<>
|
|
46
|
+
<Stack direction="row" spacing={2}>
|
|
47
|
+
<Typography level="h1">h1</Typography>
|
|
48
|
+
<Typography {...args} level="h1" />
|
|
49
|
+
</Stack>
|
|
50
|
+
<Stack direction="row" spacing={2}>
|
|
51
|
+
<Typography level="h2">h2</Typography>
|
|
52
|
+
<Typography {...args} level="h2" />
|
|
53
|
+
</Stack>
|
|
54
|
+
<Stack direction="row" spacing={2}>
|
|
55
|
+
<Typography level="h3">h3</Typography>
|
|
56
|
+
<Typography {...args} level="h3" />
|
|
57
|
+
</Stack>
|
|
58
|
+
<Stack direction="row" spacing={2}>
|
|
59
|
+
<Typography level="h4">h4</Typography>
|
|
60
|
+
<Typography {...args} level="h4" />
|
|
61
|
+
</Stack>
|
|
62
|
+
<Stack direction="row" spacing={2}>
|
|
63
|
+
<Typography level="title-lg">title-lg</Typography>
|
|
64
|
+
<Typography {...args} level="title-lg" />
|
|
65
|
+
</Stack>
|
|
66
|
+
<Stack direction="row" spacing={2}>
|
|
67
|
+
<Typography level="title-md">title-md</Typography>
|
|
68
|
+
<Typography {...args} level="title-md" />
|
|
69
|
+
</Stack>
|
|
70
|
+
<Stack direction="row" spacing={2}>
|
|
71
|
+
<Typography level="title-sm">title-sm</Typography>
|
|
72
|
+
<Typography {...args} level="title-sm" />
|
|
73
|
+
</Stack>
|
|
74
|
+
<Stack direction="row" spacing={2}>
|
|
75
|
+
<Typography level="body-lg">body-lg</Typography>
|
|
76
|
+
<Typography {...args} level="body-lg" />
|
|
77
|
+
</Stack>
|
|
78
|
+
<Stack direction="row" spacing={2}>
|
|
79
|
+
<Typography level="body-md">body-md</Typography>
|
|
80
|
+
<Typography {...args} level="body-md" />
|
|
81
|
+
</Stack>
|
|
82
|
+
<Stack direction="row" spacing={2}>
|
|
83
|
+
<Typography level="body-sm">body-sm</Typography>
|
|
84
|
+
<Typography {...args} level="body-sm" />
|
|
85
|
+
</Stack>
|
|
86
|
+
<Stack direction="row" spacing={2}>
|
|
87
|
+
<Typography level="body-xs">body-xs</Typography>
|
|
88
|
+
<Typography {...args} level="body-xs" />
|
|
89
|
+
</Stack>
|
|
90
|
+
</>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Style Reference
|
|
94
|
+
|
|
95
|
+
| Level | Font Family | Font Size | Font Weight | Line Height | Letter Spacing | Default Color | HTML Tag |
|
|
96
|
+
| -------- | --------------- | --------------- | -------------- | ----------- | -------------- | -------------- | -------- |
|
|
97
|
+
| h1 | display (Inter) | 2.25rem (36px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h1>` |
|
|
98
|
+
| h2 | display (Inter) | 1.875rem (30px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h2>` |
|
|
99
|
+
| h3 | display (Inter) | 1.5rem (24px) | 600 (SemiBold) | 1.333 | -0.025em | text.primary | `<h3>` |
|
|
100
|
+
| h4 | display (Inter) | 1.25rem (20px) | 600 (SemiBold) | 1.5 | -0.025em | text.primary | `<h4>` |
|
|
101
|
+
| title-lg | body (Inter) | 1.125rem (18px) | 600 (SemiBold) | 1.333 | - | text.primary | `<p>` |
|
|
102
|
+
| title-md | body (Inter) | 1rem (16px) | 500 (Medium) | 1.5 | - | text.primary | `<p>` |
|
|
103
|
+
| title-sm | body (Inter) | 0.875rem (14px) | 500 (Medium) | 1.429 | - | text.primary | `<p>` |
|
|
104
|
+
| body-lg | body (Inter) | 1.125rem (18px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
105
|
+
| body-md | body (Inter) | 1rem (16px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
106
|
+
| body-sm | body (Inter) | 0.875rem (14px) | inherit | 1.5 | - | text.tertiary | `<p>` |
|
|
107
|
+
| body-xs | body (Inter) | 0.75rem (12px) | 500 (Medium) | 1.5 | - | text.tertiary | `<span>` |
|
|
108
|
+
|
|
36
109
|
### Headings
|
|
37
110
|
|
|
38
|
-
|
|
111
|
+
Heading levels define page structure and hierarchy. They use the display font family with heavier weights for visual prominence.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<>
|
|
115
|
+
<Typography level="h1">h1 - Main page heading</Typography>
|
|
116
|
+
<Typography level="h2">h2 - Section heading</Typography>
|
|
117
|
+
<Typography level="h3">h3 - Subsection heading</Typography>
|
|
118
|
+
<Typography level="h4">h4 - Detail heading</Typography>
|
|
119
|
+
</>
|
|
120
|
+
```
|
|
39
121
|
|
|
40
122
|
```tsx
|
|
41
|
-
<Typography level="h1">H1 -
|
|
42
|
-
<Typography level="h2">H2 -
|
|
43
|
-
<Typography level="h3">H3 -
|
|
44
|
-
<Typography level="h4">H4 -
|
|
123
|
+
<Typography level="h1">H1 - Main page heading</Typography>
|
|
124
|
+
<Typography level="h2">H2 - Section heading</Typography>
|
|
125
|
+
<Typography level="h3">H3 - Subsection heading</Typography>
|
|
126
|
+
<Typography level="h4">H4 - Detail heading</Typography>
|
|
45
127
|
```
|
|
46
128
|
|
|
47
129
|
### Titles
|
|
48
130
|
|
|
49
|
-
|
|
131
|
+
Title levels are used for UI labels, card titles, and other emphasized text that is not a document heading.
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
<>
|
|
135
|
+
<Typography level="title-lg">title-lg - Large title</Typography>
|
|
136
|
+
<Typography level="title-md">title-md - Medium title</Typography>
|
|
137
|
+
<Typography level="title-sm">title-sm - Small title</Typography>
|
|
138
|
+
</>
|
|
139
|
+
```
|
|
50
140
|
|
|
51
141
|
```tsx
|
|
52
142
|
<Typography level="title-lg">Large Title</Typography>
|
|
@@ -56,13 +146,210 @@ function MyComponent() {
|
|
|
56
146
|
|
|
57
147
|
### Body Text
|
|
58
148
|
|
|
59
|
-
|
|
149
|
+
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.
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
<>
|
|
153
|
+
<Typography level="body-lg">body-lg - Large body text</Typography>
|
|
154
|
+
<Typography level="body-md">body-md - Regular body text</Typography>
|
|
155
|
+
<Typography level="body-sm">body-sm - Small body text</Typography>
|
|
156
|
+
<Typography level="body-xs">body-xs - Extra small text</Typography>
|
|
157
|
+
</>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
<Typography level="body-lg">Large body text</Typography>
|
|
162
|
+
<Typography level="body-md">Regular body text</Typography>
|
|
163
|
+
<Typography level="body-sm">Small body text</Typography>
|
|
164
|
+
<Typography level="body-xs">Extra small text</Typography>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Design Token Reference
|
|
168
|
+
|
|
169
|
+
### Font Size Scale
|
|
170
|
+
|
|
171
|
+
| Token | Value |
|
|
172
|
+
| ----- | --------------- |
|
|
173
|
+
| xs | 0.75rem (12px) |
|
|
174
|
+
| sm | 0.875rem (14px) |
|
|
175
|
+
| md | 1rem (16px) |
|
|
176
|
+
| lg | 1.125rem (18px) |
|
|
177
|
+
| xl | 1.25rem (20px) |
|
|
178
|
+
| xl2 | 1.5rem (24px) |
|
|
179
|
+
| xl3 | 1.875rem (30px) |
|
|
180
|
+
| xl4 | 2.25rem (36px) |
|
|
181
|
+
|
|
182
|
+
### Font Weight Scale
|
|
183
|
+
|
|
184
|
+
| Token | Value |
|
|
185
|
+
| ----- | -------------- |
|
|
186
|
+
| sm | 300 (Light) |
|
|
187
|
+
| md | 500 (Medium) |
|
|
188
|
+
| lg | 600 (SemiBold) |
|
|
189
|
+
| xl | 700 (Bold) |
|
|
190
|
+
|
|
191
|
+
### Line Height Scale
|
|
192
|
+
|
|
193
|
+
| Token | Value |
|
|
194
|
+
| ----- | ----- |
|
|
195
|
+
| xs | 1.333 |
|
|
196
|
+
| sm | 1.429 |
|
|
197
|
+
| md | 1.5 |
|
|
198
|
+
| lg | 1.556 |
|
|
199
|
+
| xl | 1.667 |
|
|
200
|
+
|
|
201
|
+
### Font Families
|
|
202
|
+
|
|
203
|
+
- **body**: `"Inter"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
204
|
+
- **display**: `"Inter"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
205
|
+
- **code**: `"Source Code Pro"`, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
|
|
206
|
+
|
|
207
|
+
## Colors
|
|
208
|
+
|
|
209
|
+
Typography supports five semantic colors via the `color` prop. Use `textColor` to apply any palette color directly.
|
|
210
|
+
|
|
211
|
+
```tsx
|
|
212
|
+
<>
|
|
213
|
+
<Typography color="primary">Primary color</Typography>
|
|
214
|
+
<Typography color="neutral">Neutral color</Typography>
|
|
215
|
+
<Typography color="danger">Danger color</Typography>
|
|
216
|
+
<Typography color="success">Success color</Typography>
|
|
217
|
+
<Typography color="warning">Warning color</Typography>
|
|
218
|
+
</>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
<Typography color="primary">Primary color</Typography>
|
|
223
|
+
<Typography color="neutral">Neutral color</Typography>
|
|
224
|
+
<Typography color="danger">Danger color</Typography>
|
|
225
|
+
<Typography color="success">Success color</Typography>
|
|
226
|
+
<Typography color="warning">Warning color</Typography>
|
|
227
|
+
|
|
228
|
+
{/* Use textColor for specific palette values */}
|
|
229
|
+
<Typography textColor="neutral.600">Custom palette color</Typography>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Component Prop
|
|
233
|
+
|
|
234
|
+
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.
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
<>
|
|
238
|
+
<Typography level="h1" component="h2">
|
|
239
|
+
h1 style rendered as h2 tag
|
|
240
|
+
</Typography>
|
|
241
|
+
<Typography level="body-md" component="span">
|
|
242
|
+
body-md rendered as span
|
|
243
|
+
</Typography>
|
|
244
|
+
<Typography level="title-md" component="label">
|
|
245
|
+
title-md rendered as label
|
|
246
|
+
</Typography>
|
|
247
|
+
</>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
```tsx
|
|
251
|
+
<Typography level="h1" component="h2">
|
|
252
|
+
h1 style rendered as an h2 tag
|
|
253
|
+
</Typography>
|
|
254
|
+
|
|
255
|
+
<Typography level="body-md" component="span">
|
|
256
|
+
Inline text
|
|
257
|
+
</Typography>
|
|
258
|
+
|
|
259
|
+
<Typography level="title-md" component="label">
|
|
260
|
+
Rendered as a label element
|
|
261
|
+
</Typography>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Default HTML tag mapping:**
|
|
265
|
+
|
|
266
|
+
| Level | Default HTML Tag |
|
|
267
|
+
| -------- | ---------------- |
|
|
268
|
+
| h1 | `<h1>` |
|
|
269
|
+
| h2 | `<h2>` |
|
|
270
|
+
| h3 | `<h3>` |
|
|
271
|
+
| h4 | `<h4>` |
|
|
272
|
+
| title-lg | `<p>` |
|
|
273
|
+
| title-md | `<p>` |
|
|
274
|
+
| title-sm | `<p>` |
|
|
275
|
+
| body-lg | `<p>` |
|
|
276
|
+
| body-md | `<p>` |
|
|
277
|
+
| body-sm | `<p>` |
|
|
278
|
+
| body-xs | `<span>` |
|
|
279
|
+
|
|
280
|
+
## Decorators
|
|
281
|
+
|
|
282
|
+
Use `startDecorator` and `endDecorator` to add icons or other elements before or after the text.
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
<>
|
|
286
|
+
<Typography startDecorator={<InfoOutlined />}>
|
|
287
|
+
Text with start decorator
|
|
288
|
+
</Typography>
|
|
289
|
+
<Typography endDecorator={<ArrowForward />}>
|
|
290
|
+
Text with end decorator
|
|
291
|
+
</Typography>
|
|
292
|
+
<Typography startDecorator={<InfoOutlined />} endDecorator={<ArrowForward />}>
|
|
293
|
+
Text with both decorators
|
|
294
|
+
</Typography>
|
|
295
|
+
</>
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
```tsx
|
|
299
|
+
import InfoOutlined from '@mui/icons-material/InfoOutlined';
|
|
300
|
+
import ArrowForward from '@mui/icons-material/ArrowForward';
|
|
301
|
+
|
|
302
|
+
<Typography startDecorator={<InfoOutlined />}>
|
|
303
|
+
Text with start decorator
|
|
304
|
+
</Typography>
|
|
305
|
+
|
|
306
|
+
<Typography endDecorator={<ArrowForward />}>
|
|
307
|
+
Text with end decorator
|
|
308
|
+
</Typography>
|
|
309
|
+
|
|
310
|
+
<Typography startDecorator={<InfoOutlined />} endDecorator={<ArrowForward />}>
|
|
311
|
+
Text with both decorators
|
|
312
|
+
</Typography>
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Text Overflow (noWrap)
|
|
316
|
+
|
|
317
|
+
Use the `noWrap` prop to truncate overflowing text with an ellipsis. Pair it with a `maxWidth` to constrain the text width.
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
<Typography noWrap sx={{
|
|
321
|
+
maxWidth: 200
|
|
322
|
+
}}>
|
|
323
|
+
This is a long text that will be truncated with an ellipsis when it
|
|
324
|
+
exceeds the maximum width of the container.
|
|
325
|
+
</Typography>
|
|
326
|
+
```
|
|
60
327
|
|
|
61
328
|
```tsx
|
|
62
|
-
<Typography
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
329
|
+
<Typography noWrap sx={{ maxWidth: 200 }}>
|
|
330
|
+
This is a long text that will be truncated with an ellipsis when it exceeds
|
|
331
|
+
the maximum width.
|
|
332
|
+
</Typography>
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
## Responsive Typography
|
|
336
|
+
|
|
337
|
+
You can pass a responsive object to the `level` prop, or use `sx` to set responsive font sizes.
|
|
338
|
+
|
|
339
|
+
```tsx
|
|
340
|
+
{/* Responsive level */}
|
|
341
|
+
<Typography level={{ xs: 'h3', sm: 'h2', md: 'h1' }}>
|
|
342
|
+
Responsive Heading
|
|
343
|
+
</Typography>
|
|
344
|
+
|
|
345
|
+
{/* Responsive font size via sx */}
|
|
346
|
+
<Typography
|
|
347
|
+
sx={{
|
|
348
|
+
fontSize: { xs: '1rem', sm: '1.25rem', md: '1.5rem' },
|
|
349
|
+
}}
|
|
350
|
+
>
|
|
351
|
+
Responsive text
|
|
352
|
+
</Typography>
|
|
66
353
|
```
|
|
67
354
|
|
|
68
355
|
## Common Use Cases
|
|
@@ -74,24 +361,24 @@ function ArticlePage() {
|
|
|
74
361
|
return (
|
|
75
362
|
<article>
|
|
76
363
|
<Typography level="h1" sx={{ mb: 2 }}>
|
|
77
|
-
|
|
364
|
+
Article Title
|
|
78
365
|
</Typography>
|
|
79
366
|
|
|
80
367
|
<Typography level="body-sm" color="neutral" sx={{ mb: 3 }}>
|
|
81
|
-
|
|
368
|
+
January 15, 2024 · Written by John Doe
|
|
82
369
|
</Typography>
|
|
83
370
|
|
|
84
371
|
<Typography level="body-md" sx={{ mb: 2 }}>
|
|
85
|
-
|
|
86
|
-
|
|
372
|
+
The main content of the article goes here. This text uses a readable size
|
|
373
|
+
and line spacing.
|
|
87
374
|
</Typography>
|
|
88
375
|
|
|
89
376
|
<Typography level="h2" sx={{ mt: 4, mb: 2 }}>
|
|
90
|
-
|
|
377
|
+
Section Title
|
|
91
378
|
</Typography>
|
|
92
379
|
|
|
93
380
|
<Typography level="body-md">
|
|
94
|
-
|
|
381
|
+
The section content continues here.
|
|
95
382
|
</Typography>
|
|
96
383
|
</article>
|
|
97
384
|
);
|
|
@@ -104,15 +391,15 @@ function ArticlePage() {
|
|
|
104
391
|
<Card>
|
|
105
392
|
<CardContent>
|
|
106
393
|
<Typography level="title-md" sx={{ mb: 1 }}>
|
|
107
|
-
|
|
394
|
+
Product Name
|
|
108
395
|
</Typography>
|
|
109
396
|
|
|
110
397
|
<Typography level="body-sm" color="neutral" sx={{ mb: 2 }}>
|
|
111
|
-
|
|
398
|
+
Category: Electronics
|
|
112
399
|
</Typography>
|
|
113
400
|
|
|
114
401
|
<Typography level="body-md" sx={{ mb: 2 }}>
|
|
115
|
-
|
|
402
|
+
A detailed description of the product goes here.
|
|
116
403
|
</Typography>
|
|
117
404
|
|
|
118
405
|
<Typography level="title-lg" color="primary">
|
|
@@ -128,41 +415,58 @@ function ArticlePage() {
|
|
|
128
415
|
<Stack spacing={2}>
|
|
129
416
|
<FormControl>
|
|
130
417
|
<Typography level="title-sm" component="label">
|
|
131
|
-
|
|
418
|
+
Username
|
|
132
419
|
</Typography>
|
|
133
|
-
<Input placeholder="
|
|
420
|
+
<Input placeholder="Enter your name" />
|
|
134
421
|
<Typography level="body-xs" color="neutral">
|
|
135
|
-
|
|
422
|
+
Please enter your real name.
|
|
136
423
|
</Typography>
|
|
137
424
|
</FormControl>
|
|
138
425
|
|
|
139
426
|
<FormControl error>
|
|
140
427
|
<Typography level="title-sm" component="label">
|
|
141
|
-
|
|
428
|
+
Email Address
|
|
142
429
|
</Typography>
|
|
143
430
|
<Input placeholder="email@example.com" />
|
|
144
431
|
<Typography level="body-xs" color="danger">
|
|
145
|
-
|
|
432
|
+
The email format is invalid.
|
|
146
433
|
</Typography>
|
|
147
434
|
</FormControl>
|
|
148
435
|
</Stack>
|
|
149
436
|
```
|
|
150
437
|
|
|
438
|
+
> 💡 **Tip: Use built-in form props instead**
|
|
439
|
+
>
|
|
440
|
+
> Input, Select, Textarea, DatePicker 등 Input 계열 컴포넌트는 `label`, `helperText` prop을 자체적으로 지원합니다.
|
|
441
|
+
> Form을 구성할 때는 Typography로 직접 label/helperText를 만드는 것보다 각 컴포넌트의 내장 prop을 사용하는 것이 권장됩니다.
|
|
442
|
+
>
|
|
443
|
+
> ```tsx
|
|
444
|
+
> // ✅ Recommended: 컴포넌트 내장 prop 사용
|
|
445
|
+
> <Input label="Username" helperText="Please enter your real name." />
|
|
446
|
+
>
|
|
447
|
+
> // ❌ Not recommended: Typography로 직접 구성
|
|
448
|
+
> <FormControl>
|
|
449
|
+
> <Typography level="title-sm" component="label">Username</Typography>
|
|
450
|
+
> <Input placeholder="Enter your name" />
|
|
451
|
+
> <Typography level="body-xs" color="neutral">Please enter your real name.</Typography>
|
|
452
|
+
> </FormControl>
|
|
453
|
+
> ```
|
|
454
|
+
|
|
151
455
|
### Status and Indicators
|
|
152
456
|
|
|
153
457
|
```tsx
|
|
154
458
|
<Stack spacing={2}>
|
|
155
459
|
<Box>
|
|
156
|
-
<Typography level="body-md"
|
|
460
|
+
<Typography level="body-md">Server Status:</Typography>
|
|
157
461
|
<Typography level="body-md" color="success">
|
|
158
|
-
|
|
462
|
+
Operating Normally
|
|
159
463
|
</Typography>
|
|
160
464
|
</Box>
|
|
161
465
|
|
|
162
466
|
<Box>
|
|
163
|
-
<Typography level="body-md"
|
|
467
|
+
<Typography level="body-md">Last Updated:</Typography>
|
|
164
468
|
<Typography level="body-sm" color="neutral">
|
|
165
|
-
2
|
|
469
|
+
2 minutes ago
|
|
166
470
|
</Typography>
|
|
167
471
|
</Box>
|
|
168
472
|
</Stack>
|
|
@@ -172,7 +476,7 @@ function ArticlePage() {
|
|
|
172
476
|
|
|
173
477
|
```tsx
|
|
174
478
|
<Stack spacing={1}>
|
|
175
|
-
<Typography level="title-md"
|
|
479
|
+
<Typography level="title-md">Todo List</Typography>
|
|
176
480
|
|
|
177
481
|
{todoItems.map((item) => (
|
|
178
482
|
<Box key={item.id} sx={{ pl: 2 }}>
|
|
@@ -180,7 +484,7 @@ function ArticlePage() {
|
|
|
180
484
|
level="body-md"
|
|
181
485
|
sx={{
|
|
182
486
|
textDecoration: item.completed ? 'line-through' : 'none',
|
|
183
|
-
color: item.completed ? 'neutral.500' : 'text.primary'
|
|
487
|
+
color: item.completed ? 'neutral.500' : 'text.primary',
|
|
184
488
|
}}
|
|
185
489
|
>
|
|
186
490
|
{item.text}
|
|
@@ -193,79 +497,41 @@ function ArticlePage() {
|
|
|
193
497
|
</Stack>
|
|
194
498
|
```
|
|
195
499
|
|
|
196
|
-
##
|
|
500
|
+
## Best Practices
|
|
197
501
|
|
|
198
|
-
|
|
502
|
+
1. **Semantic Structure**: Use heading levels in order (`h1` → `h2` → `h3`) to create a clear document hierarchy.
|
|
199
503
|
|
|
200
504
|
```tsx
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
</
|
|
505
|
+
// ✅ Correct order
|
|
506
|
+
<Typography level="h1">Main heading</Typography>
|
|
507
|
+
<Typography level="h2">Section heading</Typography>
|
|
508
|
+
<Typography level="h3">Subsection</Typography>
|
|
509
|
+
|
|
510
|
+
// ❌ Incorrect order — skipping h2
|
|
511
|
+
<Typography level="h1">Main heading</Typography>
|
|
512
|
+
<Typography level="h3">Section heading</Typography>
|
|
208
513
|
```
|
|
209
514
|
|
|
210
|
-
|
|
515
|
+
2. **Consistency**: Use the same level for text serving the same purpose across the application.
|
|
211
516
|
|
|
212
|
-
|
|
517
|
+
3. **Readability**: Provide proper line spacing and paragraph separation for body text.
|
|
213
518
|
|
|
214
|
-
|
|
215
|
-
<Typography level="h1" component="h2">
|
|
216
|
-
h2 태그로 렌더링되는 h1 스타일
|
|
217
|
-
</Typography>
|
|
519
|
+
4. **Color Contrast**: Maintain sufficient color contrast to ensure accessibility.
|
|
218
520
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
521
|
+
5. **Level Selection Guide**:
|
|
522
|
+
- **Headings** (`h1`–`h4`): Use for document structure and section titles.
|
|
523
|
+
- **Titles** (`title-lg/md/sm`): Use for UI labels, card headers, and emphasized text.
|
|
524
|
+
- **Body** (`body-lg/md/sm/xs`): Use for content, descriptions, and supporting text.
|
|
222
525
|
|
|
223
|
-
|
|
224
|
-
링크 컴포넌트로 렌더링
|
|
225
|
-
</Typography>
|
|
226
|
-
```
|
|
526
|
+
6. **Avoid inline style overrides**: Prefer the `level` prop over `sx` for font sizing. Use `level` for consistent design tokens.
|
|
227
527
|
|
|
228
|
-
|
|
528
|
+
7. **Use `textColor` for custom colors**: When the five semantic colors are insufficient, use `textColor` to apply any palette value directly.
|
|
229
529
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
```tsx
|
|
233
|
-
<Typography
|
|
234
|
-
level={{ xs: 'h3', sm: 'h2', md: 'h1' }}
|
|
235
|
-
sx={{
|
|
236
|
-
fontSize: { xs: '1.5rem', sm: '2rem', md: '2.5rem' }
|
|
237
|
-
}}
|
|
238
|
-
>
|
|
239
|
-
반응형 제목
|
|
240
|
-
</Typography>
|
|
241
|
-
```
|
|
242
|
-
|
|
243
|
-
## Best Practices
|
|
244
|
-
|
|
245
|
-
1. **의미적 구조**: 제목 레벨을 순서대로 사용하여 명확한 문서 구조를 만드세요.
|
|
246
|
-
|
|
247
|
-
```tsx
|
|
248
|
-
// ✅ 올바른 순서
|
|
249
|
-
<Typography level="h1">메인 제목</Typography>
|
|
250
|
-
<Typography level="h2">섹션 제목</Typography>
|
|
251
|
-
<Typography level="h3">하위 섹션</Typography>
|
|
252
|
-
|
|
253
|
-
// ❌ 잘못된 순서
|
|
254
|
-
<Typography level="h1">메인 제목</Typography>
|
|
255
|
-
<Typography level="h3">섹션 제목</Typography>
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
2. **일관성**: 같은 용도의 텍스트에는 같은 레벨을 사용하세요.
|
|
259
|
-
|
|
260
|
-
3. **가독성**: 본문 텍스트에는 적절한 줄 간격과 문단 구분을 제공하세요.
|
|
261
|
-
|
|
262
|
-
4. **색상 대비**: 충분한 색상 대비를 유지하여 접근성을 보장하세요.
|
|
530
|
+
8. **Use `body-xs` sparingly**: Reserve `body-xs` (12px) for auxiliary information such as timestamps, counters, and footnotes — not for primary content.
|
|
263
531
|
|
|
264
532
|
## Accessibility
|
|
265
533
|
|
|
266
|
-
-
|
|
267
|
-
-
|
|
268
|
-
-
|
|
269
|
-
-
|
|
270
|
-
|
|
271
|
-
Typography는 사용자 인터페이스에서 정보를 효과적으로 전달하고 시각적 계층 구조를 만드는 데 핵심적인 역할을 합니다. 적절한 레벨과 스타일을 선택하여 읽기 쉽고 접근 가능한 콘텐츠를 만들 수 있습니다.
|
|
534
|
+
- Use sequential heading levels (`h1` → `h2` → `h3`). Do not skip levels.
|
|
535
|
+
- 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).
|
|
536
|
+
- Avoid using `body-xs` (12px) for essential content — the small size may be difficult to read.
|
|
537
|
+
- Maintain sufficient color contrast ratios (WCAG AA: 4.5:1 for normal text, 3:1 for large text).
|