@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
|
-
Chip
|
|
5
|
+
The Chip component is a compact UI element used to represent inputs, attributes, and actions. It is commonly used for tags, filters, contacts, categories, and similar items. It can be used with text, icons, or avatars, and provides interactive behaviors such as clicking or deleting.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Chip {...args} />
|
|
@@ -28,7 +28,10 @@ function MyComponent() {
|
|
|
28
28
|
<Chip clickable onClick={() => console.log('clicked')}>
|
|
29
29
|
Clickable Chip
|
|
30
30
|
</Chip>
|
|
31
|
-
<Chip
|
|
31
|
+
<Chip
|
|
32
|
+
endDecorator={<CloseIcon />}
|
|
33
|
+
onClick={() => console.log('delete')}
|
|
34
|
+
>
|
|
32
35
|
Deletable Chip
|
|
33
36
|
</Chip>
|
|
34
37
|
</div>
|
|
@@ -40,7 +43,7 @@ function MyComponent() {
|
|
|
40
43
|
|
|
41
44
|
### Basic Usage
|
|
42
45
|
|
|
43
|
-
|
|
46
|
+
Basic Chip usage.
|
|
44
47
|
|
|
45
48
|
```tsx
|
|
46
49
|
<div style={{
|
|
@@ -56,7 +59,7 @@ function MyComponent() {
|
|
|
56
59
|
|
|
57
60
|
### Colors
|
|
58
61
|
|
|
59
|
-
|
|
62
|
+
You can apply various colors.
|
|
60
63
|
|
|
61
64
|
```tsx
|
|
62
65
|
<div style={{
|
|
@@ -74,7 +77,7 @@ function MyComponent() {
|
|
|
74
77
|
|
|
75
78
|
### Variants
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
Provides a variety of style variants.
|
|
78
81
|
|
|
79
82
|
```tsx
|
|
80
83
|
<div style={{
|
|
@@ -91,7 +94,7 @@ function MyComponent() {
|
|
|
91
94
|
|
|
92
95
|
### Sizes
|
|
93
96
|
|
|
94
|
-
|
|
97
|
+
You can adjust the size.
|
|
95
98
|
|
|
96
99
|
```tsx
|
|
97
100
|
<div style={{
|
|
@@ -108,7 +111,7 @@ function MyComponent() {
|
|
|
108
111
|
|
|
109
112
|
### With Icons
|
|
110
113
|
|
|
111
|
-
|
|
114
|
+
Can be used with icons.
|
|
112
115
|
|
|
113
116
|
```tsx
|
|
114
117
|
<div style={{
|
|
@@ -126,7 +129,7 @@ function MyComponent() {
|
|
|
126
129
|
|
|
127
130
|
### With Avatar
|
|
128
131
|
|
|
129
|
-
|
|
132
|
+
Can be used with an avatar to represent a user.
|
|
130
133
|
|
|
131
134
|
```tsx
|
|
132
135
|
<div style={{
|
|
@@ -141,7 +144,7 @@ function MyComponent() {
|
|
|
141
144
|
|
|
142
145
|
### Deletable
|
|
143
146
|
|
|
144
|
-
|
|
147
|
+
A Chip with delete functionality. Clicking it removes it from the list.
|
|
145
148
|
|
|
146
149
|
```tsx
|
|
147
150
|
<div style={{
|
|
@@ -157,7 +160,7 @@ function MyComponent() {
|
|
|
157
160
|
|
|
158
161
|
### Clickable
|
|
159
162
|
|
|
160
|
-
|
|
163
|
+
A clickable Chip that can be used as a filter or tab.
|
|
161
164
|
|
|
162
165
|
```tsx
|
|
163
166
|
<div style={{
|
|
@@ -177,7 +180,7 @@ function MyComponent() {
|
|
|
177
180
|
|
|
178
181
|
### Clickable Actions
|
|
179
182
|
|
|
180
|
-
|
|
183
|
+
Can trigger various actions when clicked.
|
|
181
184
|
|
|
182
185
|
```tsx
|
|
183
186
|
<div style={{
|
|
@@ -197,7 +200,7 @@ function MyComponent() {
|
|
|
197
200
|
|
|
198
201
|
### States
|
|
199
202
|
|
|
200
|
-
|
|
203
|
+
Can represent various states.
|
|
201
204
|
|
|
202
205
|
```tsx
|
|
203
206
|
<div style={{
|
|
@@ -262,7 +265,11 @@ function MyComponent() {
|
|
|
262
265
|
### Filter Controls
|
|
263
266
|
|
|
264
267
|
```tsx
|
|
265
|
-
<Chip
|
|
268
|
+
<Chip
|
|
269
|
+
clickable
|
|
270
|
+
variant={isActive ? 'solid' : 'outlined'}
|
|
271
|
+
onClick={() => setFilter('all')}
|
|
272
|
+
>
|
|
266
273
|
All Items
|
|
267
274
|
</Chip>
|
|
268
275
|
```
|
|
@@ -270,21 +277,43 @@ function MyComponent() {
|
|
|
270
277
|
### Contact Pills
|
|
271
278
|
|
|
272
279
|
```tsx
|
|
273
|
-
<Chip
|
|
280
|
+
<Chip
|
|
281
|
+
startDecorator={<Avatar size="sm" />}
|
|
282
|
+
endDecorator={<CloseIcon />}
|
|
283
|
+
onDelete={() => removeContact(id)}
|
|
284
|
+
>
|
|
274
285
|
John Doe
|
|
275
286
|
</Chip>
|
|
276
287
|
```
|
|
277
288
|
|
|
289
|
+
## Props and Customization
|
|
290
|
+
|
|
291
|
+
### Key Props
|
|
292
|
+
|
|
293
|
+
| Prop | Type | Default | Description |
|
|
294
|
+
| ---------------- | -------------------------------------------------------------- | ----------- | -------------------------------------- |
|
|
295
|
+
| `children` | `ReactNode` | - | Chip content (text, icons) |
|
|
296
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'soft'` | Visual style |
|
|
297
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Chip size |
|
|
298
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
299
|
+
| `disabled` | `boolean` | `false` | Disables the chip |
|
|
300
|
+
| `onClick` | `(event: MouseEvent) => void` | - | Click handler (makes chip interactive) |
|
|
301
|
+
| `startDecorator` | `ReactNode` | - | Content before the chip text |
|
|
302
|
+
| `endDecorator` | `ReactNode` | - | Content after the chip text |
|
|
303
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
304
|
+
|
|
305
|
+
> **Note**: Chip also accepts all Joy UI Chip props and Framer Motion props.
|
|
306
|
+
|
|
278
307
|
## Best Practices
|
|
279
308
|
|
|
280
|
-
1.
|
|
309
|
+
1. **Use appropriate sizes**: Choose sizes that fit the content. Keep text concise.
|
|
281
310
|
|
|
282
|
-
2.
|
|
311
|
+
2. **Be consistent**: Use the same variant and color within the same context.
|
|
283
312
|
|
|
284
|
-
3.
|
|
313
|
+
3. **Clear actions**: When using clickable or deletable behavior, provide clear feedback to the user.
|
|
285
314
|
|
|
286
|
-
4.
|
|
315
|
+
4. **Accessibility**: Support keyboard navigation and provide appropriate labels for screen readers.
|
|
287
316
|
|
|
288
|
-
5.
|
|
317
|
+
5. **Appropriate spacing**: Use proper spacing when listing multiple Chips to improve readability.
|
|
289
318
|
|
|
290
|
-
6.
|
|
319
|
+
6. **Semantic color usage**: Use colors with clear meaning, such as green for success and orange for warnings.
|
|
@@ -1726,6 +1726,99 @@ This is inspector: {selectedRowId}
|
|
|
1726
1726
|
</Stack>
|
|
1727
1727
|
```
|
|
1728
1728
|
|
|
1729
|
+
## Props and Customization
|
|
1730
|
+
|
|
1731
|
+
### DataTableProps
|
|
1732
|
+
|
|
1733
|
+
| Prop | Type | Default | Description |
|
|
1734
|
+
| ------------------------------- | ------------------------------------------------------------------- | ----------------------- | ----------------------------------------------------- |
|
|
1735
|
+
| `rows` | `T[]` | (required) | Array of row data objects |
|
|
1736
|
+
| `columns` | `ColumnDef<T, ID>[]` | (required) | Column definitions array |
|
|
1737
|
+
| `getId` | `(row: T) => ID` | - | Custom row identifier function (defaults to `row.id`) |
|
|
1738
|
+
| `checkboxSelection` | `boolean` | `false` | Enables checkbox selection column |
|
|
1739
|
+
| `selectionModel` | `ID[]` | - | Controlled selection state |
|
|
1740
|
+
| `onSelectionModelChange` | `(model: ID[], isTotalSelected?: boolean) => void` | - | Callback when selection changes |
|
|
1741
|
+
| `isRowSelectable` | `(params: { row, id }) => boolean` | - | Determines if a row can be selected |
|
|
1742
|
+
| `disableSelectionOnClick` | `boolean` | `false` | Prevents selection when clicking a row |
|
|
1743
|
+
| `isTotalSelected` | `boolean` | `false` | Represents total selection state in server pagination |
|
|
1744
|
+
| `editMode` | `boolean` | `false` | Enables inline cell editing |
|
|
1745
|
+
| `pagination` | `boolean` | `false` | Enables pagination |
|
|
1746
|
+
| `paginationMode` | `'client' \| 'server'` | `'client'` | Client-side or server-side pagination |
|
|
1747
|
+
| `paginationModel` | `{ page: number; pageSize: number }` | - | Controlled pagination state |
|
|
1748
|
+
| `onPaginationModelChange` | `(model: { page, pageSize }) => void` | - | Callback when page or page size changes |
|
|
1749
|
+
| `rowCount` | `number` | - | Total row count (required for server pagination) |
|
|
1750
|
+
| `sortModel` | `SortModel<T>[]` | - | Controlled sort state |
|
|
1751
|
+
| `sortOrder` | `('asc' \| 'desc' \| null)[]` | `['asc', 'desc', null]` | Allowed sort directions cycle |
|
|
1752
|
+
| `onSortModelChange` | `(model: SortModel<T>[]) => void` | - | Callback when sort changes |
|
|
1753
|
+
| `pinnedColumns` | `{ left?: string[]; right?: string[] }` | - | Pin columns to left/right edges |
|
|
1754
|
+
| `columnGroupingModel` | `ColumnGroupingModel` | - | Column header grouping configuration |
|
|
1755
|
+
| `columnVisibilityModel` | `Record<string, boolean>` | - | Controlled column visibility (false = hidden) |
|
|
1756
|
+
| `onColumnVisibilityModelChange` | `(model: Record<string, boolean>) => void` | - | Callback when visibility changes |
|
|
1757
|
+
| `loading` | `boolean` | `false` | Shows loading overlay |
|
|
1758
|
+
| `hoverRow` | `boolean` | `false` | Highlights rows on hover |
|
|
1759
|
+
| `stickyHeader` | `boolean` | `false` | Fixes the header when scrolling |
|
|
1760
|
+
| `stripe` | `'even' \| 'odd'` | - | Applies striped row background |
|
|
1761
|
+
| `noWrap` | `boolean` | `false` | Prevents cell text wrapping |
|
|
1762
|
+
| `onRowClick` | `(params: { row, rowId }, event) => void` | - | Callback when a row is clicked |
|
|
1763
|
+
| `slots` | `{ checkbox?, toolbar?, footer?, loadingOverlay?, noRowsOverlay? }` | - | Custom component slots |
|
|
1764
|
+
| `slotProps` | `{ checkbox?, toolbar?, background?, noRowsOverlay? }` | - | Props passed to slot components |
|
|
1765
|
+
| `apiRef` | `React.RefObject<DataTableApi>` | - | Imperative API reference |
|
|
1766
|
+
| `initialState` | `{ sorting?, columns? }` | - | Initial state for uncontrolled sort/visibility |
|
|
1767
|
+
|
|
1768
|
+
### ColumnDef Union Type
|
|
1769
|
+
|
|
1770
|
+
All column types extend `BaseColumnDef` with shared properties:
|
|
1771
|
+
|
|
1772
|
+
| Prop | Type | Default | Description |
|
|
1773
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------- | ---------- | ------------------------------------------------ |
|
|
1774
|
+
| `field` | `keyof T` | (required) | Row data field to display |
|
|
1775
|
+
| `headerName` | `string` | - | Column header text |
|
|
1776
|
+
| `type` | `'text' \| 'number' \| 'currency' \| 'date' \| 'select' \| 'autocomplete' \| 'longText' \| 'link' \| 'actions'` | `'text'` | Column type (determines edit UI) |
|
|
1777
|
+
| `width` | `string` | - | Column width (e.g., `'200px'`, `'30%'`) |
|
|
1778
|
+
| `minWidth` | `string` | - | Minimum column width |
|
|
1779
|
+
| `maxWidth` | `string` | - | Maximum column width |
|
|
1780
|
+
| `resizable` | `boolean` | `false` | Enables column resizing by dragging |
|
|
1781
|
+
| `sortable` | `boolean` | `true` | Enables sorting for this column |
|
|
1782
|
+
| `sortComparator` | `(params: { rowA, rowB }) => number` | - | Custom sort logic |
|
|
1783
|
+
| `sortOrder` | `('asc' \| 'desc' \| null)[]` | - | Column-specific sort direction cycle |
|
|
1784
|
+
| `required` | `boolean` | `false` | Shows required indicator (\*) in header |
|
|
1785
|
+
| `headerLineClamp` | `1 \| 2` | `1` | Max header text lines before truncation |
|
|
1786
|
+
| `description` | `string` | - | Tooltip text for the column header |
|
|
1787
|
+
| `cellClassName` | `string \| ((params: { row, value }) => string)` | - | Dynamic cell CSS class |
|
|
1788
|
+
| `headerClassName` | `string \| ((params) => string)` | - | Dynamic header CSS class |
|
|
1789
|
+
| `renderCell` | `(params: { row, value, rowIndex, colIndex, id }) => ReactNode` | - | Custom cell renderer |
|
|
1790
|
+
| `renderEditCell` | `(params) => ReactNode` | - | Custom edit cell renderer |
|
|
1791
|
+
| `isCellEditable` | `boolean \| ((params: { row, value, id }) => boolean)` | `true` | Whether a cell is editable |
|
|
1792
|
+
| `componentProps` | `object \| ((params: { row, id }) => object)` | - | Props passed to the column type's edit component |
|
|
1793
|
+
| `onCellEditStart` | `(params: { row, originalRow, value }) => void` | - | Callback when cell editing begins |
|
|
1794
|
+
| `onCellEditStop` | `(params: { row, originalRow, value }) => void` | - | Callback when cell editing ends |
|
|
1795
|
+
|
|
1796
|
+
### ActionsColumnDef
|
|
1797
|
+
|
|
1798
|
+
For action columns, use `type: 'actions'` with `getActions`:
|
|
1799
|
+
|
|
1800
|
+
```tsx
|
|
1801
|
+
{
|
|
1802
|
+
field: 'actions',
|
|
1803
|
+
type: 'actions',
|
|
1804
|
+
getActions: ({ row, id }) => [
|
|
1805
|
+
<Button key="edit" size="sm">Edit</Button>,
|
|
1806
|
+
<IconMenuButton key="more" items={[...]} />,
|
|
1807
|
+
],
|
|
1808
|
+
}
|
|
1809
|
+
```
|
|
1810
|
+
|
|
1811
|
+
### DataTableApi
|
|
1812
|
+
|
|
1813
|
+
```tsx
|
|
1814
|
+
interface DataTableApi {
|
|
1815
|
+
getRowIndexRelativeToVisibleRows(rowId: string): number;
|
|
1816
|
+
setCellFocus(rowId: string): void;
|
|
1817
|
+
}
|
|
1818
|
+
```
|
|
1819
|
+
|
|
1820
|
+
> **Note**: DataTable also accepts all Joy UI Table props (e.g., `borderAxis`, `size`, `sx`).
|
|
1821
|
+
|
|
1729
1822
|
## Constraints and Considerations
|
|
1730
1823
|
|
|
1731
1824
|
### Required Conditions
|
|
@@ -114,6 +114,18 @@ function MetricCard() {
|
|
|
114
114
|
}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
## Props and Customization
|
|
118
|
+
|
|
119
|
+
### Key Props
|
|
120
|
+
|
|
121
|
+
| Prop | Type | Default | Description |
|
|
122
|
+
| ----------- | -------------------------------------------------------------- | ----------- | ------------------------------------- |
|
|
123
|
+
| `message` | `string` | (required) | Tooltip message text |
|
|
124
|
+
| `placement` | `TooltipPlacement` | `'top'` | Tooltip position relative to the icon |
|
|
125
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Icon color |
|
|
126
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Icon size |
|
|
127
|
+
| `sx` | `SxProps` | - | Custom styles |
|
|
128
|
+
|
|
117
129
|
## Best Practices
|
|
118
130
|
|
|
119
131
|
- **Keep messages concise.** Tooltip messages should be 1-2 sentences that quickly answer "what does this mean?" Avoid paragraphs of text.
|
|
@@ -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.
|