@ceed/cds 1.29.0 → 1.29.1
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/Overview.md +5 -5
- package/dist/components/data-display/Avatar.md +110 -69
- package/dist/components/data-display/Badge.md +91 -39
- package/dist/components/data-display/Chip.md +49 -20
- package/dist/components/data-display/DataTable.md +93 -0
- package/dist/components/data-display/InfoSign.md +12 -0
- package/dist/components/data-display/Table.md +72 -55
- package/dist/components/data-display/Tooltip.md +40 -40
- package/dist/components/data-display/Typography.md +53 -70
- package/dist/components/feedback/Alert.md +88 -72
- package/dist/components/feedback/CircularProgress.md +17 -0
- package/dist/components/feedback/Skeleton.md +17 -0
- package/dist/components/inputs/Button.md +94 -68
- package/dist/components/inputs/ButtonGroup.md +17 -0
- package/dist/components/inputs/Calendar.md +118 -457
- package/dist/components/inputs/Checkbox.md +185 -430
- package/dist/components/inputs/CurrencyInput.md +22 -0
- package/dist/components/inputs/DatePicker.md +36 -0
- package/dist/components/inputs/DateRangePicker.md +26 -0
- package/dist/components/inputs/FilterableCheckboxGroup.md +20 -3
- package/dist/components/inputs/FormControl.md +32 -2
- package/dist/components/inputs/IconButton.md +18 -0
- package/dist/components/inputs/Input.md +198 -136
- package/dist/components/inputs/MonthPicker.md +25 -0
- package/dist/components/inputs/MonthRangePicker.md +23 -0
- package/dist/components/inputs/PercentageInput.md +25 -0
- package/dist/components/inputs/RadioButton.md +23 -0
- package/dist/components/inputs/RadioList.md +20 -1
- package/dist/components/inputs/RadioTileGroup.md +37 -3
- package/dist/components/inputs/Select.md +56 -0
- package/dist/components/inputs/Slider.md +23 -0
- package/dist/components/inputs/Switch.md +20 -0
- package/dist/components/inputs/Textarea.md +32 -8
- package/dist/components/inputs/Uploader/Uploader.md +21 -0
- package/dist/components/layout/Box.md +52 -41
- package/dist/components/layout/Grid.md +87 -81
- package/dist/components/layout/Stack.md +88 -68
- package/dist/components/navigation/Breadcrumbs.md +57 -46
- package/dist/components/navigation/Drawer.md +17 -0
- package/dist/components/navigation/Dropdown.md +13 -0
- package/dist/components/navigation/IconMenuButton.md +17 -0
- package/dist/components/navigation/InsetDrawer.md +130 -292
- package/dist/components/navigation/Link.md +78 -0
- package/dist/components/navigation/Menu.md +17 -0
- package/dist/components/navigation/MenuButton.md +18 -0
- package/dist/components/navigation/Pagination.md +13 -0
- package/dist/components/navigation/Stepper.md +15 -0
- package/dist/components/navigation/Tabs.md +27 -0
- package/dist/components/surfaces/Accordions.md +804 -49
- package/dist/components/surfaces/Card.md +173 -97
- package/dist/components/surfaces/Divider.md +246 -82
- package/dist/components/surfaces/Sheet.md +15 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
Tooltip
|
|
5
|
+
The Tooltip component is an overlay that provides additional information or help when a user hovers over an element. It is based on Joy UI Tooltip and is used to display concise, useful information that improves the user experience. Common use cases include button descriptions, icon meanings, and showing the full content of truncated text.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Tooltip
|
|
@@ -39,7 +39,7 @@ function MyComponent() {
|
|
|
39
39
|
|
|
40
40
|
### Basic Usage
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
The most basic Tooltip usage.
|
|
43
43
|
|
|
44
44
|
```tsx
|
|
45
45
|
<Tooltip
|
|
@@ -51,7 +51,7 @@ function MyComponent() {
|
|
|
51
51
|
|
|
52
52
|
### Controlled Tooltip
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
A Tooltip controlled programmatically.
|
|
55
55
|
|
|
56
56
|
```tsx
|
|
57
57
|
<Tooltip
|
|
@@ -66,7 +66,7 @@ function MyComponent() {
|
|
|
66
66
|
|
|
67
67
|
### Icon Button Descriptions
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
Used to explain the meaning of icon buttons.
|
|
70
70
|
|
|
71
71
|
```tsx
|
|
72
72
|
<Stack direction="row" spacing={1}>
|
|
@@ -92,7 +92,7 @@ function MyComponent() {
|
|
|
92
92
|
|
|
93
93
|
### Truncated Text
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
Used to display the full content of truncated text.
|
|
96
96
|
|
|
97
97
|
```tsx
|
|
98
98
|
function TruncatedText({ text }: { text: string }) {
|
|
@@ -119,7 +119,7 @@ function TruncatedText({ text }: { text: string }) {
|
|
|
119
119
|
|
|
120
120
|
### Form Field Help
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
Used to provide additional help for form fields.
|
|
123
123
|
|
|
124
124
|
```tsx
|
|
125
125
|
<Stack spacing={2}>
|
|
@@ -139,7 +139,7 @@ function TruncatedText({ text }: { text: string }) {
|
|
|
139
139
|
|
|
140
140
|
### Status Indicators
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
Used to display status or progress information.
|
|
143
143
|
|
|
144
144
|
```tsx
|
|
145
145
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
@@ -168,7 +168,7 @@ function TruncatedText({ text }: { text: string }) {
|
|
|
168
168
|
|
|
169
169
|
### Navigation Hints
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
Used to provide help text for navigation elements.
|
|
172
172
|
|
|
173
173
|
```tsx
|
|
174
174
|
<Stack direction="row" spacing={2}>
|
|
@@ -196,7 +196,7 @@ function TruncatedText({ text }: { text: string }) {
|
|
|
196
196
|
|
|
197
197
|
### Complex Content
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
A Tooltip with complex content.
|
|
200
200
|
|
|
201
201
|
```tsx
|
|
202
202
|
<Tooltip
|
|
@@ -222,7 +222,7 @@ function TruncatedText({ text }: { text: string }) {
|
|
|
222
222
|
|
|
223
223
|
### Interactive Elements
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
Used with interactive elements.
|
|
226
226
|
|
|
227
227
|
```tsx
|
|
228
228
|
<Stack direction="row" spacing={2}>
|
|
@@ -248,15 +248,15 @@ function TruncatedText({ text }: { text: string }) {
|
|
|
248
248
|
|
|
249
249
|
### Title Prop
|
|
250
250
|
|
|
251
|
-
|
|
251
|
+
Specifies the content displayed in the Tooltip.
|
|
252
252
|
|
|
253
253
|
```tsx
|
|
254
|
-
//
|
|
254
|
+
// Simple text
|
|
255
255
|
<Tooltip title="간단한 도움말">
|
|
256
256
|
<Button>버튼</Button>
|
|
257
257
|
</Tooltip>
|
|
258
258
|
|
|
259
|
-
// React
|
|
259
|
+
// React element
|
|
260
260
|
<Tooltip
|
|
261
261
|
title={
|
|
262
262
|
<div>
|
|
@@ -271,7 +271,7 @@ Tooltip에 표시될 내용을 지정합니다.
|
|
|
271
271
|
|
|
272
272
|
### Placement
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
You can adjust where the Tooltip appears.
|
|
275
275
|
|
|
276
276
|
```tsx
|
|
277
277
|
<Stack direction="row" spacing={2} sx={{ mt: 4 }}>
|
|
@@ -295,7 +295,7 @@ Tooltip이 나타나는 위치를 조정할 수 있습니다.
|
|
|
295
295
|
|
|
296
296
|
### Colors and Variants
|
|
297
297
|
|
|
298
|
-
|
|
298
|
+
You can apply various colors and variants.
|
|
299
299
|
|
|
300
300
|
```tsx
|
|
301
301
|
<Stack direction="row" spacing={2}>
|
|
@@ -319,7 +319,7 @@ Tooltip이 나타나는 위치를 조정할 수 있습니다.
|
|
|
319
319
|
|
|
320
320
|
### Arrow
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
You can show an arrow to make it clear which element the Tooltip points to.
|
|
323
323
|
|
|
324
324
|
```tsx
|
|
325
325
|
<Stack direction="row" spacing={2}>
|
|
@@ -335,7 +335,7 @@ Tooltip이 나타나는 위치를 조정할 수 있습니다.
|
|
|
335
335
|
|
|
336
336
|
### Controlled Mode
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
You can control the Tooltip's visibility programmatically.
|
|
339
339
|
|
|
340
340
|
```tsx
|
|
341
341
|
function ControlledTooltip() {
|
|
@@ -355,11 +355,11 @@ function ControlledTooltip() {
|
|
|
355
355
|
|
|
356
356
|
## Accessibility
|
|
357
357
|
|
|
358
|
-
Tooltip
|
|
358
|
+
The Tooltip component provides the following accessibility features:
|
|
359
359
|
|
|
360
|
-
### ARIA
|
|
360
|
+
### ARIA Attributes
|
|
361
361
|
|
|
362
|
-
|
|
362
|
+
Appropriate ARIA attributes are applied automatically.
|
|
363
363
|
|
|
364
364
|
```tsx
|
|
365
365
|
<Tooltip title="저장 버튼">
|
|
@@ -369,16 +369,16 @@ Tooltip 컴포넌트는 다음과 같은 접근성 기능을 제공합니다:
|
|
|
369
369
|
</Tooltip>
|
|
370
370
|
```
|
|
371
371
|
|
|
372
|
-
###
|
|
372
|
+
### Keyboard Support
|
|
373
373
|
|
|
374
|
-
|
|
374
|
+
Keyboard users can also use the Tooltip.
|
|
375
375
|
|
|
376
|
-
- **Tab**:
|
|
377
|
-
- **Escape**:
|
|
376
|
+
- **Tab**: Move to a focusable element
|
|
377
|
+
- **Escape**: Close the open Tooltip
|
|
378
378
|
|
|
379
|
-
###
|
|
379
|
+
### Touch Device Support
|
|
380
380
|
|
|
381
|
-
|
|
381
|
+
Supports tap gestures so the Tooltip can also be used on touch devices.
|
|
382
382
|
|
|
383
383
|
```tsx
|
|
384
384
|
<Tooltip title="터치 기기에서도 동작합니다" touchTapDelay={0}>
|
|
@@ -388,30 +388,30 @@ Tooltip 컴포넌트는 다음과 같은 접근성 기능을 제공합니다:
|
|
|
388
388
|
|
|
389
389
|
## Best Practices
|
|
390
390
|
|
|
391
|
-
1.
|
|
391
|
+
1. **Concise content**: Keep Tooltip content brief and easy to understand.
|
|
392
392
|
|
|
393
393
|
```tsx
|
|
394
|
-
// ✅
|
|
394
|
+
// ✅ Good example
|
|
395
395
|
<Tooltip title="삭제">
|
|
396
396
|
<IconButton><DeleteIcon /></IconButton>
|
|
397
397
|
</Tooltip>
|
|
398
398
|
|
|
399
|
-
// ❌
|
|
399
|
+
// ❌ Bad example
|
|
400
400
|
<Tooltip title="이 버튼을 클릭하면 선택된 항목이 영구적으로 삭제되며 복구할 수 없습니다">
|
|
401
401
|
<IconButton><DeleteIcon /></IconButton>
|
|
402
402
|
</Tooltip>
|
|
403
403
|
```
|
|
404
404
|
|
|
405
|
-
2.
|
|
405
|
+
2. **Use another channel for critical information**: Do not rely on a Tooltip alone for essential information.
|
|
406
406
|
|
|
407
|
-
3.
|
|
407
|
+
3. **Appropriate timing**: Show it only when the user needs help.
|
|
408
408
|
|
|
409
|
-
4.
|
|
409
|
+
4. **Consistent placement**: Use consistent placement across the application.
|
|
410
410
|
|
|
411
|
-
5.
|
|
411
|
+
5. **Performance considerations**: On pages with many Tooltips, render them only when needed.
|
|
412
412
|
|
|
413
413
|
```tsx
|
|
414
|
-
//
|
|
414
|
+
// Conditional Tooltip
|
|
415
415
|
{
|
|
416
416
|
(needsTooltip && (
|
|
417
417
|
<Tooltip title="도움말">
|
|
@@ -421,15 +421,15 @@ Tooltip 컴포넌트는 다음과 같은 접근성 기능을 제공합니다:
|
|
|
421
421
|
}
|
|
422
422
|
```
|
|
423
423
|
|
|
424
|
-
6.
|
|
424
|
+
6. **Mobile considerations**: Consider alternative ways to provide information in mobile environments.
|
|
425
425
|
|
|
426
|
-
7.
|
|
426
|
+
7. **Do not rely on color alone**: Communicate information with text or icons as well.
|
|
427
427
|
|
|
428
428
|
## Performance Considerations
|
|
429
429
|
|
|
430
|
-
1.
|
|
430
|
+
1. **Deferred rendering**: If there are many Tooltips, render them only when needed.
|
|
431
431
|
|
|
432
|
-
2.
|
|
432
|
+
2. **Memoization**: Consider memoizing complex `title` content.
|
|
433
433
|
|
|
434
434
|
```tsx
|
|
435
435
|
const tooltipContent = useMemo(() => <ComplexTooltipContent data={data} />, [data]);
|
|
@@ -439,6 +439,6 @@ const tooltipContent = useMemo(() => <ComplexTooltipContent data={data} />, [dat
|
|
|
439
439
|
</Tooltip>;
|
|
440
440
|
```
|
|
441
441
|
|
|
442
|
-
3.
|
|
442
|
+
3. **Event listener optimization**: Clean up custom event handlers properly.
|
|
443
443
|
|
|
444
|
-
Tooltip
|
|
444
|
+
Tooltip is an important UI component for providing additional context and guidance to users. Used appropriately, it can significantly improve the user experience.
|
|
@@ -4,8 +4,6 @@
|
|
|
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
|
-
|
|
9
7
|
```tsx
|
|
10
8
|
<Typography children="Typography" />
|
|
11
9
|
```
|
|
@@ -37,12 +35,11 @@ function MyComponent() {
|
|
|
37
35
|
|
|
38
36
|
### Overview
|
|
39
37
|
|
|
40
|
-
Typography levels are divided into
|
|
38
|
+
Typography levels are divided into three groups: **Headings**, **Titles**, and **Body**. The default level is `body-md`.
|
|
41
39
|
|
|
42
|
-
- **Headings** (`h1`–`h4`): Used for page and section headings. Uses the display font family (
|
|
40
|
+
- **Headings** (`h1`–`h4`): Used for page and section headings. Uses the display font family (Inter).
|
|
43
41
|
- **Titles** (`title-lg`, `title-md`, `title-sm`): Used for UI labels, card titles, and emphasized text. Uses the body font family (Inter).
|
|
44
42
|
- **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
43
|
|
|
47
44
|
```tsx
|
|
48
45
|
<>
|
|
@@ -107,26 +104,23 @@ Typography levels are divided into four groups: **Headings**, **Titles**, **Body
|
|
|
107
104
|
|
|
108
105
|
### Style Reference
|
|
109
106
|
|
|
110
|
-
| Level
|
|
111
|
-
|
|
|
112
|
-
| h1
|
|
113
|
-
| h2
|
|
114
|
-
| h3
|
|
115
|
-
| h4
|
|
116
|
-
| title-lg
|
|
117
|
-
| title-md
|
|
118
|
-
| title-sm
|
|
119
|
-
| body-lg
|
|
120
|
-
| body-md
|
|
121
|
-
| body-sm
|
|
122
|
-
| body-xs
|
|
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>` |
|
|
107
|
+
| Level | Font Family | Font Size | Font Weight | Line Height | Letter Spacing | Default Color | HTML Tag |
|
|
108
|
+
| -------- | --------------- | --------------- | -------------- | ----------- | -------------- | -------------- | -------- |
|
|
109
|
+
| h1 | display (Inter) | 2.25rem (36px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h1>` |
|
|
110
|
+
| h2 | display (Inter) | 1.875rem (30px) | 700 (Bold) | 1.333 | -0.025em | text.primary | `<h2>` |
|
|
111
|
+
| h3 | display (Inter) | 1.5rem (24px) | 600 (SemiBold) | 1.333 | -0.025em | text.primary | `<h3>` |
|
|
112
|
+
| h4 | display (Inter) | 1.25rem (20px) | 600 (SemiBold) | 1.5 | -0.025em | text.primary | `<h4>` |
|
|
113
|
+
| title-lg | body (Inter) | 1.125rem (18px) | 600 (SemiBold) | 1.333 | - | text.primary | `<p>` |
|
|
114
|
+
| title-md | body (Inter) | 1rem (16px) | 500 (Medium) | 1.5 | - | text.primary | `<p>` |
|
|
115
|
+
| title-sm | body (Inter) | 0.875rem (14px) | 500 (Medium) | 1.429 | - | text.primary | `<p>` |
|
|
116
|
+
| body-lg | body (Inter) | 1.125rem (18px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
117
|
+
| body-md | body (Inter) | 1rem (16px) | inherit | 1.5 | - | text.secondary | `<p>` |
|
|
118
|
+
| body-sm | body (Inter) | 0.875rem (14px) | inherit | 1.5 | - | text.tertiary | `<p>` |
|
|
119
|
+
| body-xs | body (Inter) | 0.75rem (12px) | 500 (Medium) | 1.5 | - | text.tertiary | `<span>` |
|
|
126
120
|
|
|
127
121
|
### Headings
|
|
128
122
|
|
|
129
|
-
Heading levels define page structure and hierarchy.
|
|
123
|
+
Heading levels define page structure and hierarchy. They use the display font family with heavier weights for visual prominence.
|
|
130
124
|
|
|
131
125
|
```tsx
|
|
132
126
|
<>
|
|
@@ -182,30 +176,6 @@ Body levels are used for readable content and descriptions. The default level `b
|
|
|
182
176
|
<Typography level="body-xs">Extra small text</Typography>
|
|
183
177
|
```
|
|
184
178
|
|
|
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
179
|
## Design Token Reference
|
|
210
180
|
|
|
211
181
|
### Font Size Scale
|
|
@@ -243,7 +213,7 @@ Marketing levels are designed for landing pages, hero banners, and promotional c
|
|
|
243
213
|
### Font Families
|
|
244
214
|
|
|
245
215
|
- **body**: `"Inter"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
246
|
-
- **display**: `"
|
|
216
|
+
- **display**: `"Inter"`, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif
|
|
247
217
|
- **code**: `"Source Code Pro"`, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
|
|
248
218
|
|
|
249
219
|
## Colors
|
|
@@ -305,22 +275,19 @@ Use the `component` prop to render Typography as a different HTML element or Rea
|
|
|
305
275
|
|
|
306
276
|
**Default HTML tag mapping:**
|
|
307
277
|
|
|
308
|
-
| Level
|
|
309
|
-
|
|
|
310
|
-
| h1
|
|
311
|
-
| h2
|
|
312
|
-
| h3
|
|
313
|
-
| h4
|
|
314
|
-
| title-lg
|
|
315
|
-
| title-md
|
|
316
|
-
| title-sm
|
|
317
|
-
| body-lg
|
|
318
|
-
| body-md
|
|
319
|
-
| body-sm
|
|
320
|
-
| body-xs
|
|
321
|
-
| marketing-lg | `<div>` |
|
|
322
|
-
| marketing-md | `<div>` |
|
|
323
|
-
| marketing-sm | `<div>` |
|
|
278
|
+
| Level | Default HTML Tag |
|
|
279
|
+
| -------- | ---------------- |
|
|
280
|
+
| h1 | `<h1>` |
|
|
281
|
+
| h2 | `<h2>` |
|
|
282
|
+
| h3 | `<h3>` |
|
|
283
|
+
| h4 | `<h4>` |
|
|
284
|
+
| title-lg | `<p>` |
|
|
285
|
+
| title-md | `<p>` |
|
|
286
|
+
| title-sm | `<p>` |
|
|
287
|
+
| body-lg | `<p>` |
|
|
288
|
+
| body-md | `<p>` |
|
|
289
|
+
| body-sm | `<p>` |
|
|
290
|
+
| body-xs | `<span>` |
|
|
324
291
|
|
|
325
292
|
## Decorators
|
|
326
293
|
|
|
@@ -482,14 +449,14 @@ function ArticlePage() {
|
|
|
482
449
|
|
|
483
450
|
> 💡 **Tip: Use built-in form props instead**
|
|
484
451
|
>
|
|
485
|
-
> Input, Select, Textarea, DatePicker
|
|
486
|
-
>
|
|
452
|
+
> Input-family components such as Input, Select, Textarea, and DatePicker support `label` and `helperText` props natively.
|
|
453
|
+
> When building forms, it is recommended to use each component's built-in props rather than creating labels and helper text manually with Typography.
|
|
487
454
|
>
|
|
488
455
|
> ```tsx
|
|
489
|
-
> // ✅ Recommended:
|
|
456
|
+
> // ✅ Recommended: use the component's built-in props
|
|
490
457
|
> <Input label="Username" helperText="Please enter your real name." />
|
|
491
458
|
>
|
|
492
|
-
> // ❌ Not recommended:
|
|
459
|
+
> // ❌ Not recommended: manually composing with Typography
|
|
493
460
|
> <FormControl>
|
|
494
461
|
> <Typography level="title-sm" component="label">Username</Typography>
|
|
495
462
|
> <Input placeholder="Enter your name" />
|
|
@@ -542,6 +509,25 @@ function ArticlePage() {
|
|
|
542
509
|
</Stack>
|
|
543
510
|
```
|
|
544
511
|
|
|
512
|
+
## Props and Customization
|
|
513
|
+
|
|
514
|
+
### Key Props
|
|
515
|
+
|
|
516
|
+
| Prop | Type | Default | Description |
|
|
517
|
+
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------- |
|
|
518
|
+
| `children` | `ReactNode` | - | Text content |
|
|
519
|
+
| `level` | `'h1' \| 'h2' \| 'h3' \| 'h4' \| 'title-lg' \| 'title-md' \| 'title-sm' \| 'body-lg' \| 'body-md' \| 'body-sm' \| 'body-xs'` | `'body-md'` | Typography level (maps to semantic HTML elements) |
|
|
520
|
+
| `component` | `ElementType` | auto | Override the root element type |
|
|
521
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
522
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | - | Visual style (optional) |
|
|
523
|
+
| `noWrap` | `boolean` | `false` | Truncate text with ellipsis |
|
|
524
|
+
| `startDecorator` | `ReactNode` | - | Content before the text |
|
|
525
|
+
| `endDecorator` | `ReactNode` | - | Content after the text |
|
|
526
|
+
| `textColor` | `string` | - | Direct text color override |
|
|
527
|
+
| `sx` | `SxProps` | - | Custom styles |
|
|
528
|
+
|
|
529
|
+
> **Note**: Typography also accepts all Joy UI Typography props.
|
|
530
|
+
|
|
545
531
|
## Best Practices
|
|
546
532
|
|
|
547
533
|
1. **Semantic Structure**: Use heading levels in order (`h1` → `h2` → `h3`) to create a clear document hierarchy.
|
|
@@ -567,7 +553,6 @@ function ArticlePage() {
|
|
|
567
553
|
- **Headings** (`h1`–`h4`): Use for document structure and section titles.
|
|
568
554
|
- **Titles** (`title-lg/md/sm`): Use for UI labels, card headers, and emphasized text.
|
|
569
555
|
- **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
556
|
|
|
572
557
|
6. **Avoid inline style overrides**: Prefer the `level` prop over `sx` for font sizing. Use `level` for consistent design tokens.
|
|
573
558
|
|
|
@@ -575,8 +560,6 @@ function ArticlePage() {
|
|
|
575
560
|
|
|
576
561
|
8. **Use `body-xs` sparingly**: Reserve `body-xs` (12px) for auxiliary information such as timestamps, counters, and footnotes — not for primary content.
|
|
577
562
|
|
|
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
563
|
## Accessibility
|
|
581
564
|
|
|
582
565
|
- Use sequential heading levels (`h1` → `h2` → `h3`). Do not skip levels.
|