@ceed/cds 1.29.0 → 1.30.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/Overview.md +5 -5
- package/dist/components/Calendar/utils/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +4 -0
- package/dist/components/MonthRangePicker/MonthRangePicker.d.ts +8 -0
- 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 +59 -5
- package/dist/components/inputs/DateRangePicker.md +46 -5
- 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 +59 -5
- package/dist/components/inputs/MonthRangePicker.md +44 -5
- 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/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +99 -39
- package/dist/index.js +99 -39
- package/framer/index.js +1 -1
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
>
|
|
5
|
+
> **Note**: If you need to display large volumes of data, the DataTable component may be a better fit. The Table component is better suited for smaller datasets, flexible customization, and rendering complex UI inside cells. For cell merging with `rowSpan`, `colSpan`, or non-trivial table structures, we recommend composing the Table component directly.
|
|
6
6
|
|
|
7
|
-
Table
|
|
7
|
+
The Table component is a foundational table component for displaying structured data in a tabular format. It is based on Joy UI Table and supports flexible customization and complex layouts. It can be used for everything from simple data display to complex cell merging and custom content.
|
|
8
8
|
|
|
9
9
|
```tsx
|
|
10
10
|
<Table aria-label="basic table" {...args}>
|
|
@@ -51,7 +51,10 @@ function MyComponent() {
|
|
|
51
51
|
return (
|
|
52
52
|
<Table>
|
|
53
53
|
<TableHead headCells={headCells} />
|
|
54
|
-
<TableBody
|
|
54
|
+
<TableBody
|
|
55
|
+
rows={rows}
|
|
56
|
+
cellOrder={['name', 'email', 'role', 'joinDate']}
|
|
57
|
+
/>
|
|
55
58
|
</Table>
|
|
56
59
|
);
|
|
57
60
|
}
|
|
@@ -61,7 +64,7 @@ function MyComponent() {
|
|
|
61
64
|
|
|
62
65
|
### Basic Examples
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
The most basic Table usage patterns.
|
|
65
68
|
|
|
66
69
|
```tsx
|
|
67
70
|
<Table aria-label="basic table" {...args}>
|
|
@@ -85,7 +88,7 @@ function MyComponent() {
|
|
|
85
88
|
|
|
86
89
|
### With Hover Effect
|
|
87
90
|
|
|
88
|
-
|
|
91
|
+
You can apply a highlight effect when hovering over rows.
|
|
89
92
|
|
|
90
93
|
```tsx
|
|
91
94
|
<Table
|
|
@@ -96,7 +99,7 @@ function MyComponent() {
|
|
|
96
99
|
|
|
97
100
|
### With Checkbox Selection
|
|
98
101
|
|
|
99
|
-
|
|
102
|
+
A selectable table that includes checkboxes.
|
|
100
103
|
|
|
101
104
|
```tsx
|
|
102
105
|
<Table aria-label="checkbox table" hoverRow {...args}>
|
|
@@ -122,7 +125,7 @@ function MyComponent() {
|
|
|
122
125
|
|
|
123
126
|
### User Management Table
|
|
124
127
|
|
|
125
|
-
|
|
128
|
+
A table for user management. It includes avatars, role labels, status indicators, and action buttons.
|
|
126
129
|
|
|
127
130
|
```tsx
|
|
128
131
|
<Table aria-label="user management table" hoverRow>
|
|
@@ -299,7 +302,7 @@ function MyComponent() {
|
|
|
299
302
|
|
|
300
303
|
### Product Inventory Table
|
|
301
304
|
|
|
302
|
-
|
|
305
|
+
A table for product inventory management. It includes stock status, price display, progress bars, and more.
|
|
303
306
|
|
|
304
307
|
```tsx
|
|
305
308
|
<Table aria-label="product inventory table" hoverRow>
|
|
@@ -418,7 +421,7 @@ function MyComponent() {
|
|
|
418
421
|
|
|
419
422
|
### Task Management Table
|
|
420
423
|
|
|
421
|
-
|
|
424
|
+
A table for project task management. It displays assignees, priorities, progress, due dates, and more.
|
|
422
425
|
|
|
423
426
|
```tsx
|
|
424
427
|
<Table aria-label="task management table" hoverRow>
|
|
@@ -571,7 +574,7 @@ function MyComponent() {
|
|
|
571
574
|
|
|
572
575
|
### Sales Report with Cell Merging
|
|
573
576
|
|
|
574
|
-
|
|
577
|
+
A sales report table that uses complex cell merging. This example uses `rowSpan` and `colSpan`.
|
|
575
578
|
|
|
576
579
|
```tsx
|
|
577
580
|
<Table aria-label="sales report table with merged cells">
|
|
@@ -767,7 +770,7 @@ function MyComponent() {
|
|
|
767
770
|
|
|
768
771
|
### Comparison Table
|
|
769
772
|
|
|
770
|
-
|
|
773
|
+
A table for comparing plans or products. It visually represents boolean values.
|
|
771
774
|
|
|
772
775
|
```tsx
|
|
773
776
|
<Table aria-label="plan comparison table">
|
|
@@ -926,7 +929,7 @@ function MyComponent() {
|
|
|
926
929
|
|
|
927
930
|
### Empty State Table
|
|
928
931
|
|
|
929
|
-
|
|
932
|
+
A table that displays an empty state when no data is available.
|
|
930
933
|
|
|
931
934
|
```tsx
|
|
932
935
|
<Stack spacing={2}>
|
|
@@ -993,7 +996,7 @@ function MyComponent() {
|
|
|
993
996
|
|
|
994
997
|
### Advanced Features Table
|
|
995
998
|
|
|
996
|
-
|
|
999
|
+
A table that includes advanced features such as sticky headers, scrolling, and responsiveness.
|
|
997
1000
|
|
|
998
1001
|
```tsx
|
|
999
1002
|
<Box sx={{
|
|
@@ -1072,7 +1075,7 @@ function MyComponent() {
|
|
|
1072
1075
|
|
|
1073
1076
|
### Drag and Drop Headers Table
|
|
1074
1077
|
|
|
1075
|
-
|
|
1078
|
+
A table that uses `@atlaskit/pragmatic-drag-and-drop` so headers can be dragged to reorder columns.
|
|
1076
1079
|
|
|
1077
1080
|
```tsx
|
|
1078
1081
|
<Stack spacing={3}>
|
|
@@ -1126,9 +1129,9 @@ function MyComponent() {
|
|
|
1126
1129
|
|
|
1127
1130
|
### Implementation Guidelines
|
|
1128
1131
|
|
|
1129
|
-
|
|
1132
|
+
The Canvas examples above are fully working components. The Table component can be used in two ways:
|
|
1130
1133
|
|
|
1131
|
-
#### 1. TableHead
|
|
1134
|
+
#### 1. Using TableHead and TableBody (simple data)
|
|
1132
1135
|
|
|
1133
1136
|
```tsx
|
|
1134
1137
|
import { Table, TableHead, TableBody } from '@ceed/cds';
|
|
@@ -1148,15 +1151,18 @@ function SimpleTable() {
|
|
|
1148
1151
|
return (
|
|
1149
1152
|
<Table aria-label="simple table" hoverRow>
|
|
1150
1153
|
<TableHead headCells={headCells} />
|
|
1151
|
-
<TableBody
|
|
1154
|
+
<TableBody
|
|
1155
|
+
rows={rows}
|
|
1156
|
+
cellOrder={['name', 'email', 'role']}
|
|
1157
|
+
/>
|
|
1152
1158
|
</Table>
|
|
1153
1159
|
);
|
|
1154
1160
|
}
|
|
1155
1161
|
```
|
|
1156
1162
|
|
|
1157
|
-
#### 2. HTML
|
|
1163
|
+
#### 2. Using the HTML table structure (complex UI)
|
|
1158
1164
|
|
|
1159
|
-
|
|
1165
|
+
When rendering complex UI components inside cells, use the HTML table structure directly:
|
|
1160
1166
|
|
|
1161
1167
|
```tsx
|
|
1162
1168
|
import { Table, Stack, Avatar, Typography, Chip, IconButton } from '@ceed/cds';
|
|
@@ -1178,9 +1184,7 @@ function ComplexTable() {
|
|
|
1178
1184
|
<tr>
|
|
1179
1185
|
<td>
|
|
1180
1186
|
<Stack direction="row" spacing={2} alignItems="center">
|
|
1181
|
-
<Avatar size="sm" variant="soft" color="primary">
|
|
1182
|
-
김
|
|
1183
|
-
</Avatar>
|
|
1187
|
+
<Avatar size="sm" variant="soft" color="primary">김</Avatar>
|
|
1184
1188
|
<Stack spacing={0}>
|
|
1185
1189
|
<Typography level="title-sm">김철수</Typography>
|
|
1186
1190
|
<Typography level="body-xs" color="neutral">
|
|
@@ -1214,7 +1218,7 @@ function ComplexTable() {
|
|
|
1214
1218
|
|
|
1215
1219
|
#### Cell Merging with rowSpan and colSpan
|
|
1216
1220
|
|
|
1217
|
-
|
|
1221
|
+
For complex table layouts, you can use the HTML table structure directly:
|
|
1218
1222
|
|
|
1219
1223
|
```tsx
|
|
1220
1224
|
<Table>
|
|
@@ -1237,31 +1241,28 @@ function ComplexTable() {
|
|
|
1237
1241
|
|
|
1238
1242
|
## Advanced Features
|
|
1239
1243
|
|
|
1240
|
-
Table
|
|
1244
|
+
The Table component supports various advanced features:
|
|
1241
1245
|
|
|
1242
1246
|
### Sticky Headers
|
|
1243
1247
|
|
|
1244
|
-
|
|
1248
|
+
Keeps the header fixed while scrolling:
|
|
1245
1249
|
|
|
1246
1250
|
```tsx
|
|
1247
|
-
<Table
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
},
|
|
1256
|
-
}}
|
|
1257
|
-
>
|
|
1251
|
+
<Table stickyHeader sx={{
|
|
1252
|
+
'& th': {
|
|
1253
|
+
position: 'sticky',
|
|
1254
|
+
top: 0,
|
|
1255
|
+
backgroundColor: 'background.surface',
|
|
1256
|
+
zIndex: 1,
|
|
1257
|
+
}
|
|
1258
|
+
}}>
|
|
1258
1259
|
{/* Table content */}
|
|
1259
1260
|
</Table>
|
|
1260
1261
|
```
|
|
1261
1262
|
|
|
1262
1263
|
### Empty States
|
|
1263
1264
|
|
|
1264
|
-
|
|
1265
|
+
Displays an appropriate empty state when no data is available:
|
|
1265
1266
|
|
|
1266
1267
|
```tsx
|
|
1267
1268
|
<tbody>
|
|
@@ -1280,28 +1281,44 @@ Table 컴포넌트는 다양한 고급 기능을 지원합니다:
|
|
|
1280
1281
|
|
|
1281
1282
|
### Responsive Design
|
|
1282
1283
|
|
|
1283
|
-
|
|
1284
|
+
Guidance for responsive design:
|
|
1284
1285
|
|
|
1285
1286
|
```tsx
|
|
1286
|
-
<Table
|
|
1287
|
-
|
|
1288
|
-
'
|
|
1289
|
-
'
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
}}
|
|
1295
|
-
>
|
|
1287
|
+
<Table sx={{
|
|
1288
|
+
'@media (max-width: 768px)': {
|
|
1289
|
+
'& td, & th': {
|
|
1290
|
+
fontSize: 'sm',
|
|
1291
|
+
px: 1,
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
}}>
|
|
1296
1295
|
{/* Table content */}
|
|
1297
1296
|
</Table>
|
|
1298
1297
|
```
|
|
1299
1298
|
|
|
1299
|
+
## Props and Customization
|
|
1300
|
+
|
|
1301
|
+
### Key Props
|
|
1302
|
+
|
|
1303
|
+
| Prop | Type | Default | Description |
|
|
1304
|
+
| -------------- | ----------------------------------------------------------------------------- | ------------ | ----------------------------------- |
|
|
1305
|
+
| `children` | `ReactNode` | - | Table content (thead, tbody, tfoot) |
|
|
1306
|
+
| `borderAxis` | `'none' \| 'x' \| 'y' \| 'both' \| 'xBetween' \| 'yBetween' \| 'bothBetween'` | `'xBetween'` | Border display mode |
|
|
1307
|
+
| `stripe` | `'odd' \| 'even'` | - | Striped row background |
|
|
1308
|
+
| `hoverRow` | `boolean` | `false` | Highlight rows on hover |
|
|
1309
|
+
| `stickyHeader` | `boolean` | `false` | Fix the header when scrolling |
|
|
1310
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Table size |
|
|
1311
|
+
| `variant` | `'plain' \| 'outlined' \| 'soft' \| 'solid'` | `'plain'` | Visual style |
|
|
1312
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
1313
|
+
| `sx` | `SxProps` | - | Custom styles |
|
|
1314
|
+
|
|
1315
|
+
> **Note**: Table also accepts all Joy UI Table props.
|
|
1316
|
+
|
|
1300
1317
|
## Best Practices
|
|
1301
1318
|
|
|
1302
|
-
1.
|
|
1319
|
+
1. **Choose the right component**: Use DataTable for large datasets and Table for complex layouts.
|
|
1303
1320
|
|
|
1304
|
-
2.
|
|
1321
|
+
2. **Consider accessibility**: Use proper table tags and ARIA attributes.
|
|
1305
1322
|
|
|
1306
1323
|
```tsx
|
|
1307
1324
|
<Table aria-label="사용자 목록">
|
|
@@ -1320,12 +1337,12 @@ Table 컴포넌트는 다양한 고급 기능을 지원합니다:
|
|
|
1320
1337
|
</Table>
|
|
1321
1338
|
```
|
|
1322
1339
|
|
|
1323
|
-
3.
|
|
1340
|
+
3. **Consistent alignment**: Right-align numeric data and left-align text.
|
|
1324
1341
|
|
|
1325
|
-
4.
|
|
1342
|
+
4. **Appropriate row height**: Set row heights that fit the content.
|
|
1326
1343
|
|
|
1327
|
-
5.
|
|
1344
|
+
5. **Responsive considerations**: On mobile, consider showing only key columns or transforming the layout into cards.
|
|
1328
1345
|
|
|
1329
|
-
6.
|
|
1346
|
+
6. **Performance optimization**: For long lists, consider virtualization or pagination.
|
|
1330
1347
|
|
|
1331
|
-
Table
|
|
1348
|
+
The Table component is a highly useful tool for presenting structured data and implementing complex layouts. With the right usage patterns and customization, it can satisfy a wide range of requirements.
|
|
@@ -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.
|