@slotted/react 0.1.0-beta.42 → 0.1.0-beta.43
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/{app-shell-D54YkU7E.js → app-shell-DsWhsSMU.js} +3 -2
- package/dist/app-shell.js +1 -1
- package/dist/attachment-TZykYNu5.js +300 -0
- package/dist/attachment.js +2 -2
- package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
- package/dist/avatar-group.js +1 -1
- package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{command-palette-C90CzfQi.js → command-palette-Bgf5tfCI.js} +160 -156
- package/dist/command-palette.js +1 -1
- package/dist/{data-grid-D106baPp.js → data-grid-DUft3rJb.js} +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-BA0xrySM.js → data-list-Dv3orBtf.js} +15 -15
- package/dist/data-list.js +1 -1
- package/dist/detail-panel-Cke3ZFU3.js +342 -0
- package/dist/detail-panel.js +2 -2
- package/dist/docs/action-bar.examples.md +768 -0
- package/dist/docs/action-bar.json +74 -50
- package/dist/docs/action-bar.md +49 -311
- package/dist/docs/app-shell.examples.md +1221 -64
- package/dist/docs/app-shell.json +92 -60
- package/dist/docs/app-shell.md +92 -57
- package/dist/docs/attachment.examples.md +689 -0
- package/dist/docs/attachment.json +69 -37
- package/dist/docs/attachment.md +44 -203
- package/dist/docs/avatar-group.json +111 -23
- package/dist/docs/avatar-group.md +487 -28
- package/dist/docs/button-group.json +98 -2
- package/dist/docs/button-group.md +411 -8
- package/dist/docs/calendar.examples.md +512 -0
- package/dist/docs/calendar.json +72 -24
- package/dist/docs/calendar.md +18 -147
- package/dist/docs/carousel.examples.md +868 -0
- package/dist/docs/carousel.json +58 -50
- package/dist/docs/carousel.md +66 -300
- package/dist/docs/cascader.examples.md +1269 -0
- package/dist/docs/cascader.json +72 -16
- package/dist/docs/cascader.md +78 -154
- package/dist/docs/chart.examples.md +734 -24
- package/dist/docs/chart.json +93 -13
- package/dist/docs/chart.md +28 -7
- package/dist/docs/clock.json +71 -15
- package/dist/docs/clock.md +326 -21
- package/dist/docs/code-block.json +79 -55
- package/dist/docs/code-block.md +417 -74
- package/dist/docs/color-picker.json +60 -12
- package/dist/docs/color-picker.md +245 -22
- package/dist/docs/column-manager.examples.md +764 -0
- package/dist/docs/column-manager.json +68 -12
- package/dist/docs/column-manager.md +44 -203
- package/dist/docs/command-palette.examples.md +747 -0
- package/dist/docs/command-palette.json +48 -24
- package/dist/docs/command-palette.md +60 -339
- package/dist/docs/currency-field.examples.md +355 -73
- package/dist/docs/currency-field.json +96 -64
- package/dist/docs/currency-field.md +57 -50
- package/dist/docs/dashboard-grid.examples.md +629 -0
- package/dist/docs/dashboard-grid.json +64 -16
- package/dist/docs/dashboard-grid.md +34 -152
- package/dist/docs/data-list.examples.md +1556 -0
- package/dist/docs/data-list.json +58 -18
- package/dist/docs/data-list.md +139 -224
- package/dist/docs/date-field.examples.md +543 -0
- package/dist/docs/date-field.json +64 -24
- package/dist/docs/date-field.md +22 -168
- package/dist/docs/datetime-field.examples.md +699 -0
- package/dist/docs/datetime-field.json +79 -31
- package/dist/docs/datetime-field.md +24 -269
- package/dist/docs/datetime-range-picker.examples.md +682 -0
- package/dist/docs/datetime-range-picker.json +117 -61
- package/dist/docs/datetime-range-picker.md +59 -224
- package/dist/docs/description-list.examples.md +652 -0
- package/dist/docs/description-list.json +49 -25
- package/dist/docs/description-list.md +33 -188
- package/dist/docs/detail-panel.examples.md +1177 -0
- package/dist/docs/detail-panel.json +69 -53
- package/dist/docs/detail-panel.md +114 -324
- package/dist/docs/entity-picker.examples.md +1037 -0
- package/dist/docs/entity-picker.json +66 -18
- package/dist/docs/entity-picker.md +56 -246
- package/dist/docs/event-calendar.examples.md +749 -49
- package/dist/docs/event-calendar.json +46 -22
- package/dist/docs/event-calendar.md +81 -11
- package/dist/docs/field-group.examples.md +554 -0
- package/dist/docs/field-group.json +98 -34
- package/dist/docs/field-group.md +55 -133
- package/dist/docs/filter-bar.examples.md +772 -0
- package/dist/docs/filter-bar.json +41 -25
- package/dist/docs/filter-bar.md +42 -246
- package/dist/docs/form.examples.md +579 -0
- package/dist/docs/form.json +87 -39
- package/dist/docs/form.md +53 -177
- package/dist/docs/fullscreen.examples.md +558 -0
- package/dist/docs/fullscreen.json +58 -18
- package/dist/docs/fullscreen.md +50 -169
- package/dist/docs/highlight.json +57 -25
- package/dist/docs/highlight.md +402 -50
- package/dist/docs/icon.json +85 -5
- package/dist/docs/icon.md +401 -10
- package/dist/docs/image.examples.md +670 -0
- package/dist/docs/image.json +44 -28
- package/dist/docs/image.md +24 -176
- package/dist/docs/import-export-center.examples.md +1280 -0
- package/dist/docs/import-export-center.json +67 -27
- package/dist/docs/import-export-center.md +121 -226
- package/dist/docs/list-item.examples.md +769 -0
- package/dist/docs/list-item.json +110 -38
- package/dist/docs/list-item.md +84 -201
- package/dist/docs/listbox.examples.md +858 -0
- package/dist/docs/listbox.json +76 -28
- package/dist/docs/listbox.md +41 -263
- package/dist/docs/markdown.json +79 -55
- package/dist/docs/markdown.md +581 -85
- package/dist/docs/media-viewer.examples.md +1038 -0
- package/dist/docs/media-viewer.json +70 -15
- package/dist/docs/media-viewer.md +84 -135
- package/dist/docs/message-scroller.examples.md +1193 -0
- package/dist/docs/message-scroller.json +41 -17
- package/dist/docs/message-scroller.md +80 -134
- package/dist/docs/message.examples.md +944 -0
- package/dist/docs/message.json +64 -16
- package/dist/docs/message.md +34 -326
- package/dist/docs/meter.json +58 -26
- package/dist/docs/meter.md +312 -32
- package/dist/docs/navigation-menu.examples.md +1107 -0
- package/dist/docs/navigation-menu.json +57 -41
- package/dist/docs/navigation-menu.md +105 -298
- package/dist/docs/notification-center.examples.md +1045 -0
- package/dist/docs/notification-center.json +71 -15
- package/dist/docs/notification-center.md +76 -266
- package/dist/docs/otp-input.examples.md +490 -0
- package/dist/docs/otp-input.json +65 -25
- package/dist/docs/otp-input.md +20 -191
- package/dist/docs/page-header.examples.md +1041 -0
- package/dist/docs/page-header.json +75 -43
- package/dist/docs/page-header.md +79 -291
- package/dist/docs/page.examples.md +633 -0
- package/dist/docs/page.json +48 -16
- package/dist/docs/page.md +62 -129
- package/dist/docs/prompt-composer.examples.md +630 -0
- package/dist/docs/prompt-composer.json +66 -18
- package/dist/docs/prompt-composer.md +35 -161
- package/dist/docs/prose.json +69 -37
- package/dist/docs/prose.md +393 -75
- package/dist/docs/rating.examples.md +525 -0
- package/dist/docs/rating.json +92 -28
- package/dist/docs/rating.md +27 -241
- package/dist/docs/saved-views.examples.md +1108 -0
- package/dist/docs/saved-views.json +53 -21
- package/dist/docs/saved-views.md +86 -171
- package/dist/docs/scroll-area.examples.md +837 -0
- package/dist/docs/scroll-area.json +64 -24
- package/dist/docs/scroll-area.md +57 -140
- package/dist/docs/section.examples.md +676 -0
- package/dist/docs/section.json +68 -20
- package/dist/docs/section.md +39 -162
- package/dist/docs/segmented-control.examples.md +480 -0
- package/dist/docs/segmented-control.json +76 -28
- package/dist/docs/segmented-control.md +20 -191
- package/dist/docs/side-navigation.examples.md +1468 -0
- package/dist/docs/side-navigation.json +53 -53
- package/dist/docs/side-navigation.md +79 -354
- package/dist/docs/slider.examples.md +505 -0
- package/dist/docs/slider.json +91 -51
- package/dist/docs/slider.md +47 -212
- package/dist/docs/sparkline.json +60 -36
- package/dist/docs/sparkline.md +447 -71
- package/dist/docs/split-button.examples.md +509 -0
- package/dist/docs/split-button.json +73 -41
- package/dist/docs/split-button.md +64 -194
- package/dist/docs/splitter.examples.md +921 -0
- package/dist/docs/splitter.json +94 -46
- package/dist/docs/splitter.md +75 -182
- package/dist/docs/stat-card.examples.md +725 -0
- package/dist/docs/stat-card.json +89 -41
- package/dist/docs/stat-card.md +55 -227
- package/dist/docs/status-indicator.json +80 -32
- package/dist/docs/status-indicator.md +409 -65
- package/dist/docs/stepper.json +53 -21
- package/dist/docs/stepper.md +369 -48
- package/dist/docs/table-of-contents.examples.md +550 -0
- package/dist/docs/table-of-contents.json +60 -28
- package/dist/docs/table-of-contents.md +70 -205
- package/dist/docs/tags-input.examples.md +541 -0
- package/dist/docs/tags-input.json +64 -16
- package/dist/docs/tags-input.md +15 -262
- package/dist/docs/time-field.examples.md +587 -0
- package/dist/docs/time-field.json +69 -29
- package/dist/docs/time-field.md +21 -223
- package/dist/docs/time-picker.json +117 -53
- package/dist/docs/time-picker.md +499 -54
- package/dist/docs/time-range-picker.examples.md +750 -0
- package/dist/docs/time-range-picker.json +139 -75
- package/dist/docs/time-range-picker.md +63 -225
- package/dist/docs/timeline.examples.md +617 -0
- package/dist/docs/timeline.json +44 -28
- package/dist/docs/timeline.md +34 -208
- package/dist/docs/toolbar.json +56 -16
- package/dist/docs/toolbar.md +357 -63
- package/dist/docs/top-navigation.examples.md +1206 -140
- package/dist/docs/top-navigation.json +49 -33
- package/dist/docs/top-navigation.md +87 -36
- package/dist/docs/tour.examples.md +960 -0
- package/dist/docs/tour.json +57 -25
- package/dist/docs/tour.md +60 -244
- package/dist/docs/transfer.examples.md +631 -0
- package/dist/docs/transfer.json +80 -16
- package/dist/docs/transfer.md +41 -170
- package/dist/docs/typography.json +96 -0
- package/dist/docs/typography.md +352 -4
- package/dist/docs/upload.examples.md +555 -53
- package/dist/docs/upload.json +62 -30
- package/dist/docs/upload.md +46 -11
- package/dist/docs/wizard.examples.md +1389 -0
- package/dist/docs/wizard.json +89 -49
- package/dist/docs/wizard.md +122 -263
- package/dist/{entity-picker-CC4VoC3p.js → entity-picker-C78f3Z0o.js} +9 -6
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-CjmF_e0H.js → event-calendar-DJPoCi-O.js} +1 -1
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-D61wiQFP.js} +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-CW8YVZev.js → import-export-center-mqvmlzwB.js} +44 -36
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +58 -58
- package/dist/{markdown-BdskE4-L.js → markdown-8CtV4k44.js} +2 -2
- package/dist/markdown.js +1 -1
- package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
- package/dist/media-viewer.js +2 -2
- package/dist/message-P91bEGyV.js +455 -0
- package/dist/message.js +2 -2
- package/dist/{page-header-DmwBGwlm.js → page-header-jeAIQSZM.js} +103 -108
- package/dist/page-header.js +1 -1
- package/dist/section-CVTQdWBl.js +216 -0
- package/dist/section.js +2 -2
- package/dist/{segmented-control-CbK7SurB.js → segmented-control-BSMVjukr.js} +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/{side-navigation-CKRETc8E.js → side-navigation-BQzBxz2B.js} +179 -179
- package/dist/side-navigation.js +1 -1
- package/dist/{stat-card-CL3Xe6pV.js → stat-card-BpGZiFbG.js} +12 -14
- package/dist/stat-card.js +1 -1
- package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
- package/dist/stepper.js +2 -2
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
- package/dist/timeline.js +1 -1
- package/dist/top-navigation-YSEQzBhD.js +744 -0
- package/dist/top-navigation.js +2 -2
- package/dist/{transfer-sKUvmEKe.js → transfer-Cv5yQuTN.js} +1 -1
- package/dist/transfer.js +1 -1
- package/dist/types/attachment/attachment-parts.d.ts +24 -11
- package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
- package/dist/types/attachment/attachment.d.ts +3 -3
- package/dist/types/attachment/attachment.d.ts.map +1 -1
- package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
- package/dist/types/carousel/carousel-parts.d.ts +2 -2
- package/dist/types/command-palette/command-palette.d.ts.map +1 -1
- package/dist/types/data-list/data-list.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
- package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
- package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
- package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
- package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
- package/dist/types/media-viewer/index.d.ts +2 -2
- package/dist/types/media-viewer/index.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
- package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
- package/dist/types/message/message-parts.d.ts +7 -0
- package/dist/types/message/message-parts.d.ts.map +1 -1
- package/dist/types/message/message.d.ts.map +1 -1
- package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
- package/dist/types/section/section-parts.d.ts +16 -8
- package/dist/types/section/section-parts.d.ts.map +1 -1
- package/dist/types/section/section.d.ts.map +1 -1
- package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
- package/dist/types/side-navigation/side-navigation-parts.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-parts.d.ts +3 -3
- package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper-parts.d.ts +11 -2
- package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper.d.ts.map +1 -1
- package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
- package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
- package/dist/{wizard-4c0X7Bx_.js → wizard-Dfryz1id.js} +214 -214
- package/dist/wizard.js +1 -1
- package/package.json +6 -6
- package/dist/attachment-MqczA38F.js +0 -292
- package/dist/detail-panel-EImAtksY.js +0 -327
- package/dist/message-D1Dd6Y2k.js +0 -452
- package/dist/section-D_qOfdxR.js +0 -213
- package/dist/top-navigation-D8IHPOmm.js +0 -744
|
@@ -0,0 +1,652 @@
|
|
|
1
|
+
<!-- index: ./index.md -->
|
|
2
|
+
# description-list
|
|
3
|
+
|
|
4
|
+
`data-ui="description-list"` · Term and value pairs for record details.
|
|
5
|
+
|
|
6
|
+
## Examples
|
|
7
|
+
|
|
8
|
+
### Playground
|
|
9
|
+
|
|
10
|
+
Every axis on one details panel, driven by the controls below the canvas. Change columns and variant, then narrow the window and watch the arrangement answer the panel rather than the viewport.
|
|
11
|
+
|
|
12
|
+
Excerpt — not a complete module
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<DescriptionList>
|
|
16
|
+
<DescriptionListItem>
|
|
17
|
+
<DescriptionListTerm>Environment</DescriptionListTerm>
|
|
18
|
+
<DescriptionListDescription>Production</DescriptionListDescription>
|
|
19
|
+
</DescriptionListItem>
|
|
20
|
+
</DescriptionList>;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Beside the term, or under it
|
|
24
|
+
|
|
25
|
+
Row puts the value in a column of its own, and every term in the list shares one track sized to the widest of them. Stack puts the value under its term, which is what a narrow container gets whether or not you ask.
|
|
26
|
+
|
|
27
|
+
Example
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import {
|
|
31
|
+
DescriptionList,
|
|
32
|
+
DescriptionListDescription,
|
|
33
|
+
DescriptionListItem,
|
|
34
|
+
DescriptionListTerm,
|
|
35
|
+
} from '@slotted/react/description-list';
|
|
36
|
+
import { Stack } from '@slotted/react/stack';
|
|
37
|
+
import { Text } from '@slotted/react/typography';
|
|
38
|
+
|
|
39
|
+
const LAYOUTS = [
|
|
40
|
+
{ layout: 'row', label: 'Row: the value beside its term' },
|
|
41
|
+
{ layout: 'stack', label: 'Stack: the value under its term' },
|
|
42
|
+
] as const;
|
|
43
|
+
|
|
44
|
+
const PAIRS = [
|
|
45
|
+
{ term: 'Supplier', value: 'Meridian Packaging' },
|
|
46
|
+
{ term: 'Lead time', value: '6 days' },
|
|
47
|
+
{ term: 'Payment terms', value: 'Net 30' },
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export default function DescriptionListLayoutExample() {
|
|
51
|
+
return (
|
|
52
|
+
<Stack gap={6}>
|
|
53
|
+
{LAYOUTS.map(({ layout, label }) => (
|
|
54
|
+
<Stack key={layout} gap={2}>
|
|
55
|
+
<Text size="sm" tone="muted">
|
|
56
|
+
{label}
|
|
57
|
+
</Text>
|
|
58
|
+
<DescriptionList layout={layout}>
|
|
59
|
+
{PAIRS.map(({ term, value }) => (
|
|
60
|
+
<DescriptionListItem key={term}>
|
|
61
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
62
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
63
|
+
</DescriptionListItem>
|
|
64
|
+
))}
|
|
65
|
+
</DescriptionList>
|
|
66
|
+
</Stack>
|
|
67
|
+
))}
|
|
68
|
+
</Stack>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### More than one pair to a row
|
|
74
|
+
|
|
75
|
+
Three columns become two below 48rem of the panel, two become one below 34rem. Compare the term columns: each column group sizes its own, so two groups of unlike terms do not pretend to be a table.
|
|
76
|
+
|
|
77
|
+
Example
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import {
|
|
81
|
+
DescriptionList,
|
|
82
|
+
DescriptionListDescription,
|
|
83
|
+
DescriptionListItem,
|
|
84
|
+
DescriptionListTerm,
|
|
85
|
+
} from '@slotted/react/description-list';
|
|
86
|
+
import { Stack } from '@slotted/react/stack';
|
|
87
|
+
import { Text } from '@slotted/react/typography';
|
|
88
|
+
|
|
89
|
+
const COLUMNS = [
|
|
90
|
+
{ columns: 1, label: 'One column' },
|
|
91
|
+
{ columns: 2, label: 'Two columns' },
|
|
92
|
+
{ columns: 3, label: 'Three columns' },
|
|
93
|
+
] as const;
|
|
94
|
+
|
|
95
|
+
const PAIRS = [
|
|
96
|
+
{ term: 'Warehouse', value: 'Rotterdam DC' },
|
|
97
|
+
{ term: 'Zone', value: 'Cold storage' },
|
|
98
|
+
{ term: 'Picker', value: 'Imani Okafor' },
|
|
99
|
+
{ term: 'Wave', value: '2026-03-W11' },
|
|
100
|
+
{ term: 'Dock', value: 'Dock 4' },
|
|
101
|
+
{ term: 'Priority', value: 'Standard' },
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
export default function DescriptionListColumnsExample() {
|
|
105
|
+
return (
|
|
106
|
+
<Stack gap={6}>
|
|
107
|
+
{COLUMNS.map(({ columns, label }) => (
|
|
108
|
+
<Stack key={columns} gap={2}>
|
|
109
|
+
<Text size="sm" tone="muted">
|
|
110
|
+
{label}
|
|
111
|
+
</Text>
|
|
112
|
+
<DescriptionList columns={columns} termWidth="8rem">
|
|
113
|
+
{PAIRS.map(({ term, value }) => (
|
|
114
|
+
<DescriptionListItem key={term}>
|
|
115
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
116
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
117
|
+
</DescriptionListItem>
|
|
118
|
+
))}
|
|
119
|
+
</DescriptionList>
|
|
120
|
+
</Stack>
|
|
121
|
+
))}
|
|
122
|
+
</Stack>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Nothing, a rule, or a frame
|
|
128
|
+
|
|
129
|
+
Plain is the form that belongs inside a card, where the card already draws the box. Ruled puts a hairline under every pair, including the last. Framed is the specification table: an outer frame and a tinted term cell.
|
|
130
|
+
|
|
131
|
+
Excerpt — not a complete module
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
<DescriptionList variant="plain" />;
|
|
135
|
+
<DescriptionList variant="ruled" />;
|
|
136
|
+
<DescriptionList variant="framed" />;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### A pair that needs the whole row
|
|
140
|
+
|
|
141
|
+
An address or an endpoint takes more than a third of a row, so it takes the row. A span wider than the list has columns is clamped to the count rather than growing the grid a column nobody declared.
|
|
142
|
+
|
|
143
|
+
Example
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import {
|
|
147
|
+
DescriptionList,
|
|
148
|
+
DescriptionListDescription,
|
|
149
|
+
DescriptionListItem,
|
|
150
|
+
DescriptionListTerm,
|
|
151
|
+
} from '@slotted/react/description-list';
|
|
152
|
+
|
|
153
|
+
export default function DescriptionListSpanExample() {
|
|
154
|
+
return (
|
|
155
|
+
<DescriptionList columns={2} termWidth="8rem" variant="ruled">
|
|
156
|
+
<DescriptionListItem>
|
|
157
|
+
<DescriptionListTerm>Supplier</DescriptionListTerm>
|
|
158
|
+
<DescriptionListDescription>Meridian Packaging</DescriptionListDescription>
|
|
159
|
+
</DescriptionListItem>
|
|
160
|
+
|
|
161
|
+
<DescriptionListItem>
|
|
162
|
+
<DescriptionListTerm>Lead time</DescriptionListTerm>
|
|
163
|
+
<DescriptionListDescription>6 days</DescriptionListDescription>
|
|
164
|
+
</DescriptionListItem>
|
|
165
|
+
|
|
166
|
+
<DescriptionListItem span={2}>
|
|
167
|
+
<DescriptionListTerm>Delivery address</DescriptionListTerm>
|
|
168
|
+
<DescriptionListDescription>
|
|
169
|
+
Dock 4, 120 Harbor Road, 3011 AB Rotterdam, Netherlands
|
|
170
|
+
</DescriptionListDescription>
|
|
171
|
+
</DescriptionListItem>
|
|
172
|
+
|
|
173
|
+
<DescriptionListItem span={3}>
|
|
174
|
+
<DescriptionListTerm>Receiving window</DescriptionListTerm>
|
|
175
|
+
<DescriptionListDescription>Tuesday and Friday, 06:00 to 10:00</DescriptionListDescription>
|
|
176
|
+
</DescriptionListItem>
|
|
177
|
+
|
|
178
|
+
<DescriptionListItem>
|
|
179
|
+
<DescriptionListTerm>Payment terms</DescriptionListTerm>
|
|
180
|
+
<DescriptionListDescription>Net 30</DescriptionListDescription>
|
|
181
|
+
</DescriptionListItem>
|
|
182
|
+
|
|
183
|
+
<DescriptionListItem>
|
|
184
|
+
<DescriptionListTerm>Currency</DescriptionListTerm>
|
|
185
|
+
<DescriptionListDescription>EUR</DescriptionListDescription>
|
|
186
|
+
</DescriptionListItem>
|
|
187
|
+
</DescriptionList>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### A row you can go back and change
|
|
193
|
+
|
|
194
|
+
The action is a second dd of the same group, which is what the platform is for. Tab to one and a screen reader reads the term with it, because the action is described by the dt rather than by hidden text repeated in every row.
|
|
195
|
+
|
|
196
|
+
Example
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
import {
|
|
200
|
+
DescriptionList,
|
|
201
|
+
DescriptionListAction,
|
|
202
|
+
DescriptionListDescription,
|
|
203
|
+
DescriptionListItem,
|
|
204
|
+
DescriptionListTerm,
|
|
205
|
+
} from '@slotted/react/description-list';
|
|
206
|
+
import { Link } from '@slotted/react/link';
|
|
207
|
+
|
|
208
|
+
const ROWS = [
|
|
209
|
+
{ term: 'Contact name', value: 'Dana Whitfield', href: '#contact-name' },
|
|
210
|
+
{ term: 'Contact email', value: 'dana.whitfield@meridian.example', href: '#contact-email' },
|
|
211
|
+
{ term: 'Billing address', value: '120 Harbor Road, Rotterdam', href: '#billing-address' },
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
export default function DescriptionListActionsExample() {
|
|
215
|
+
return (
|
|
216
|
+
<DescriptionList variant="ruled">
|
|
217
|
+
{ROWS.map(({ term, value, href }) => (
|
|
218
|
+
<DescriptionListItem key={term}>
|
|
219
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
220
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
221
|
+
<DescriptionListAction>
|
|
222
|
+
<Link href={href}>Change</Link>
|
|
223
|
+
</DescriptionListAction>
|
|
224
|
+
</DescriptionListItem>
|
|
225
|
+
))}
|
|
226
|
+
</DescriptionList>
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### A value that is not there
|
|
232
|
+
|
|
233
|
+
An empty cell is a row a reader cannot tell from a defect. Nullish children draw the mark — a rule, not an em dash — and a screen reader hears the reason; words you state are shown as you wrote them.
|
|
234
|
+
|
|
235
|
+
Example
|
|
236
|
+
|
|
237
|
+
```tsx
|
|
238
|
+
import {
|
|
239
|
+
DescriptionList,
|
|
240
|
+
DescriptionListDescription,
|
|
241
|
+
DescriptionListItem,
|
|
242
|
+
DescriptionListTerm,
|
|
243
|
+
} from '@slotted/react/description-list';
|
|
244
|
+
|
|
245
|
+
export default function DescriptionListEmptyExample() {
|
|
246
|
+
return (
|
|
247
|
+
<DescriptionList variant="ruled">
|
|
248
|
+
<DescriptionListItem>
|
|
249
|
+
<DescriptionListTerm>Account manager</DescriptionListTerm>
|
|
250
|
+
<DescriptionListDescription>Dana Whitfield</DescriptionListDescription>
|
|
251
|
+
</DescriptionListItem>
|
|
252
|
+
|
|
253
|
+
<DescriptionListItem>
|
|
254
|
+
<DescriptionListTerm>Secondary contact</DescriptionListTerm>
|
|
255
|
+
<DescriptionListDescription empty />
|
|
256
|
+
</DescriptionListItem>
|
|
257
|
+
|
|
258
|
+
<DescriptionListItem>
|
|
259
|
+
<DescriptionListTerm>Purchase order</DescriptionListTerm>
|
|
260
|
+
<DescriptionListDescription empty placeholder="Not issued yet" />
|
|
261
|
+
</DescriptionListItem>
|
|
262
|
+
</DescriptionList>
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### A term that explains itself
|
|
268
|
+
|
|
269
|
+
One line under the name, inside the dt, so a reader who reaches the term hears the explanation with it. It costs the list eight rem of the row arrangement, which is why it is a sentence and not a paragraph.
|
|
270
|
+
|
|
271
|
+
Example
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
import {
|
|
275
|
+
DescriptionList,
|
|
276
|
+
DescriptionListDescription,
|
|
277
|
+
DescriptionListHint,
|
|
278
|
+
DescriptionListItem,
|
|
279
|
+
DescriptionListTerm,
|
|
280
|
+
} from '@slotted/react/description-list';
|
|
281
|
+
|
|
282
|
+
const ROWS = [
|
|
283
|
+
{
|
|
284
|
+
term: 'Reorder point',
|
|
285
|
+
hint: 'The stock level that triggers a purchase order.',
|
|
286
|
+
value: '120 units',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
term: 'Safety stock',
|
|
290
|
+
hint: 'Units held back to absorb a spike in demand.',
|
|
291
|
+
value: '40 units',
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
term: 'Lead time',
|
|
295
|
+
hint: 'Days between the purchase order and the delivery.',
|
|
296
|
+
value: '6 days',
|
|
297
|
+
},
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
export default function DescriptionListHintExample() {
|
|
301
|
+
return (
|
|
302
|
+
<DescriptionList variant="ruled">
|
|
303
|
+
{ROWS.map(({ term, hint, value }) => (
|
|
304
|
+
<DescriptionListItem key={term}>
|
|
305
|
+
<DescriptionListTerm>
|
|
306
|
+
{term}
|
|
307
|
+
<DescriptionListHint>{hint}</DescriptionListHint>
|
|
308
|
+
</DescriptionListTerm>
|
|
309
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
310
|
+
</DescriptionListItem>
|
|
311
|
+
))}
|
|
312
|
+
</DescriptionList>
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### A value worth taking away
|
|
318
|
+
|
|
319
|
+
An identifier, a key, an ARN. The control writes the rendered text unless you state another, says it finished by its mark as well as its color, and announces the result politely. Where a browser refuses the clipboard, inside an iframe that carries no clipboard-write permission for instance, the control selects the value instead, so the reader can take it with the keyboard.
|
|
320
|
+
|
|
321
|
+
Example
|
|
322
|
+
|
|
323
|
+
```tsx
|
|
324
|
+
import {
|
|
325
|
+
DescriptionList,
|
|
326
|
+
DescriptionListDescription,
|
|
327
|
+
DescriptionListItem,
|
|
328
|
+
DescriptionListTerm,
|
|
329
|
+
type DescriptionListCopyRequest,
|
|
330
|
+
} from '@slotted/react/description-list';
|
|
331
|
+
import { Stack } from '@slotted/react/stack';
|
|
332
|
+
import { Text } from '@slotted/react/typography';
|
|
333
|
+
import { useState } from 'react';
|
|
334
|
+
|
|
335
|
+
export default function DescriptionListCopyExample() {
|
|
336
|
+
const [result, setResult] = useState('Nothing copied yet.');
|
|
337
|
+
|
|
338
|
+
function handleCopy(request: DescriptionListCopyRequest) {
|
|
339
|
+
setResult(describe(request));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return (
|
|
343
|
+
<Stack gap={4}>
|
|
344
|
+
<DescriptionList variant="ruled">
|
|
345
|
+
<DescriptionListItem>
|
|
346
|
+
<DescriptionListTerm>Customer ID</DescriptionListTerm>
|
|
347
|
+
<DescriptionListDescription copy onCopy={handleCopy}>
|
|
348
|
+
cus_8f3a29c1d4
|
|
349
|
+
</DescriptionListDescription>
|
|
350
|
+
</DescriptionListItem>
|
|
351
|
+
|
|
352
|
+
<DescriptionListItem>
|
|
353
|
+
<DescriptionListTerm>IBAN</DescriptionListTerm>
|
|
354
|
+
<DescriptionListDescription copy copyValue="NL91ABNA0417164300" onCopy={handleCopy}>
|
|
355
|
+
NL91 ABNA 0417 1643 00
|
|
356
|
+
</DescriptionListDescription>
|
|
357
|
+
</DescriptionListItem>
|
|
358
|
+
</DescriptionList>
|
|
359
|
+
|
|
360
|
+
<Text size="sm" tone="muted">
|
|
361
|
+
{result}
|
|
362
|
+
</Text>
|
|
363
|
+
</Stack>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function describe(request: DescriptionListCopyRequest): string {
|
|
368
|
+
if (request.copied) return `Copied ${request.value}`;
|
|
369
|
+
if (request.selected) return `The browser refused the write. ${request.value} is selected.`;
|
|
370
|
+
return 'Nothing was copied.';
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### A value longer than its row
|
|
375
|
+
|
|
376
|
+
Clamping is visual: every character stays in the DOM, selectable and readable by a screen reader, and the control brings the rest into view — and appears only where there is a rest to bring. Hold revealed yourself when the choice should survive a navigation.
|
|
377
|
+
|
|
378
|
+
Example
|
|
379
|
+
|
|
380
|
+
```tsx
|
|
381
|
+
import {
|
|
382
|
+
DescriptionList,
|
|
383
|
+
DescriptionListDescription,
|
|
384
|
+
DescriptionListItem,
|
|
385
|
+
DescriptionListTerm,
|
|
386
|
+
} from '@slotted/react/description-list';
|
|
387
|
+
import { Stack } from '@slotted/react/stack';
|
|
388
|
+
import { Text } from '@slotted/react/typography';
|
|
389
|
+
import { useState } from 'react';
|
|
390
|
+
|
|
391
|
+
const HANDLING =
|
|
392
|
+
'Pallets arrive shrink-wrapped and stacked two high. Keep them upright, move them with the forks at the long side, and scan every pallet label at the dock before the carrier leaves. Report any torn wrap or crushed corner on the delivery note before signing.';
|
|
393
|
+
|
|
394
|
+
const RECEIVING =
|
|
395
|
+
'Count the cartons against the advance shipping notice at the dock door. A shortfall above two cartons holds the whole delivery in the quarantine bay until the supplier confirms the correction in writing, and the inbound team posts the variance to the purchasing channel.';
|
|
396
|
+
|
|
397
|
+
export default function DescriptionListRevealExample() {
|
|
398
|
+
const [open, setOpen] = useState(false);
|
|
399
|
+
|
|
400
|
+
return (
|
|
401
|
+
<Stack gap={4}>
|
|
402
|
+
<DescriptionList
|
|
403
|
+
layout="stack"
|
|
404
|
+
messages={{ collapse: 'Collapse the note', reveal: 'Read the full note' }}
|
|
405
|
+
>
|
|
406
|
+
<DescriptionListItem>
|
|
407
|
+
<DescriptionListTerm>Handling note</DescriptionListTerm>
|
|
408
|
+
<DescriptionListDescription clamp={2}>{HANDLING}</DescriptionListDescription>
|
|
409
|
+
</DescriptionListItem>
|
|
410
|
+
|
|
411
|
+
<DescriptionListItem>
|
|
412
|
+
<DescriptionListTerm>Receiving note</DescriptionListTerm>
|
|
413
|
+
<DescriptionListDescription clamp={2} revealed={open} onRevealedChange={setOpen}>
|
|
414
|
+
{RECEIVING}
|
|
415
|
+
</DescriptionListDescription>
|
|
416
|
+
</DescriptionListItem>
|
|
417
|
+
</DescriptionList>
|
|
418
|
+
|
|
419
|
+
<Text size="sm" tone="muted">
|
|
420
|
+
{open ? 'The receiving note is expanded.' : 'The receiving note is clamped to two lines.'}
|
|
421
|
+
</Text>
|
|
422
|
+
</Stack>
|
|
423
|
+
);
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Inside a card, and beside the families it sits with
|
|
428
|
+
|
|
429
|
+
Card owns the title and the header actions, so this family ships neither. The value slot takes a tag, a status indicator or a skeleton, and the defaults provider decides the arrangement for a whole application; the words come from the language in force.
|
|
430
|
+
|
|
431
|
+
Example
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
import { Badge } from '@slotted/react/badge';
|
|
435
|
+
import { Card, CardBody, CardHeader } from '@slotted/react/card';
|
|
436
|
+
import {
|
|
437
|
+
DescriptionList,
|
|
438
|
+
DescriptionListDefaultsProvider,
|
|
439
|
+
DescriptionListDescription,
|
|
440
|
+
DescriptionListItem,
|
|
441
|
+
DescriptionListTerm,
|
|
442
|
+
} from '@slotted/react/description-list';
|
|
443
|
+
import { Link } from '@slotted/react/link';
|
|
444
|
+
import { Stack } from '@slotted/react/stack';
|
|
445
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
446
|
+
|
|
447
|
+
export default function DescriptionListCompositionExample() {
|
|
448
|
+
return (
|
|
449
|
+
<Card>
|
|
450
|
+
<CardHeader>
|
|
451
|
+
<Heading level={2} size="md">
|
|
452
|
+
Meridian Packaging
|
|
453
|
+
</Heading>
|
|
454
|
+
<Text size="sm" tone="muted">
|
|
455
|
+
Supplier account
|
|
456
|
+
</Text>
|
|
457
|
+
</CardHeader>
|
|
458
|
+
<CardBody>
|
|
459
|
+
<DescriptionListDefaultsProvider termWidth="10rem" variant="ruled">
|
|
460
|
+
<Stack gap={6}>
|
|
461
|
+
<DescriptionList>
|
|
462
|
+
<DescriptionListItem>
|
|
463
|
+
<DescriptionListTerm>Status</DescriptionListTerm>
|
|
464
|
+
<DescriptionListDescription>
|
|
465
|
+
<Badge tone="success" variant="soft">
|
|
466
|
+
Active
|
|
467
|
+
</Badge>
|
|
468
|
+
</DescriptionListDescription>
|
|
469
|
+
</DescriptionListItem>
|
|
470
|
+
|
|
471
|
+
<DescriptionListItem>
|
|
472
|
+
<DescriptionListTerm>Compliance review</DescriptionListTerm>
|
|
473
|
+
<DescriptionListDescription>
|
|
474
|
+
<Badge tone="warning" variant="soft">
|
|
475
|
+
Due 30 April
|
|
476
|
+
</Badge>
|
|
477
|
+
</DescriptionListDescription>
|
|
478
|
+
</DescriptionListItem>
|
|
479
|
+
|
|
480
|
+
<DescriptionListItem>
|
|
481
|
+
<DescriptionListTerm>Portal</DescriptionListTerm>
|
|
482
|
+
<DescriptionListDescription>
|
|
483
|
+
<Link href="#supplier-portal">meridian.example/portal</Link>
|
|
484
|
+
</DescriptionListDescription>
|
|
485
|
+
</DescriptionListItem>
|
|
486
|
+
</DescriptionList>
|
|
487
|
+
|
|
488
|
+
<DescriptionList variant="plain">
|
|
489
|
+
<DescriptionListItem>
|
|
490
|
+
<DescriptionListTerm>Payment terms</DescriptionListTerm>
|
|
491
|
+
<DescriptionListDescription>Net 30</DescriptionListDescription>
|
|
492
|
+
</DescriptionListItem>
|
|
493
|
+
|
|
494
|
+
<DescriptionListItem>
|
|
495
|
+
<DescriptionListTerm>Currency</DescriptionListTerm>
|
|
496
|
+
<DescriptionListDescription>EUR</DescriptionListDescription>
|
|
497
|
+
</DescriptionListItem>
|
|
498
|
+
</DescriptionList>
|
|
499
|
+
</Stack>
|
|
500
|
+
</DescriptionListDefaultsProvider>
|
|
501
|
+
</CardBody>
|
|
502
|
+
</Card>
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Content the list did not choose
|
|
508
|
+
|
|
509
|
+
A sixty-four character hash with nowhere to break, a German compound term, and a right-to-left pair. The value breaks rather than leaving the box, and the term track stops at the width you set for it.
|
|
510
|
+
|
|
511
|
+
Excerpt — not a complete module
|
|
512
|
+
|
|
513
|
+
```tsx
|
|
514
|
+
<DescriptionList termWidth="10rem">
|
|
515
|
+
<DescriptionListItem>
|
|
516
|
+
<DescriptionListTerm>Rechnungsempfängeradresse</DescriptionListTerm>
|
|
517
|
+
<DescriptionListDescription>Friedrichstraße 12, 10117 Berlin</DescriptionListDescription>
|
|
518
|
+
</DescriptionListItem>
|
|
519
|
+
</DescriptionList>;
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
### Keyboard and announcement
|
|
523
|
+
|
|
524
|
+
The component owns no key of its own: every control is a native button or your own link, so Tab, Enter and Space are the platform. Enter and Space are told apart from a press in the reason the request carries.
|
|
525
|
+
|
|
526
|
+
Excerpt — not a complete module
|
|
527
|
+
|
|
528
|
+
```tsx
|
|
529
|
+
// Copy announces politely; the toggle carries aria-expanded;
|
|
530
|
+
// the action is described by its own term.
|
|
531
|
+
<DescriptionListDescription
|
|
532
|
+
clamp={2}
|
|
533
|
+
copy
|
|
534
|
+
onRevealedChange={(next, request) => log(request.reason)}
|
|
535
|
+
>
|
|
536
|
+
{note}
|
|
537
|
+
</DescriptionListDescription>;
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
### sizing.tsx
|
|
541
|
+
|
|
542
|
+
Example
|
|
543
|
+
|
|
544
|
+
```tsx
|
|
545
|
+
import {
|
|
546
|
+
DescriptionList,
|
|
547
|
+
DescriptionListDescription,
|
|
548
|
+
DescriptionListItem,
|
|
549
|
+
DescriptionListTerm,
|
|
550
|
+
} from '@slotted/react/description-list';
|
|
551
|
+
import { Stack } from '@slotted/react/stack';
|
|
552
|
+
import { Text } from '@slotted/react/typography';
|
|
553
|
+
|
|
554
|
+
const TOTALS = [
|
|
555
|
+
{ term: 'Subtotal', value: '€3,920.00' },
|
|
556
|
+
{ term: 'Freight', value: '€210.00' },
|
|
557
|
+
{ term: 'VAT (9%)', value: '€371.70' },
|
|
558
|
+
{ term: 'Total', value: '€4,501.70' },
|
|
559
|
+
];
|
|
560
|
+
|
|
561
|
+
const SPECS = [
|
|
562
|
+
{ term: 'Weight', value: '412 kg' },
|
|
563
|
+
{ term: 'Volume', value: '2.4 m³' },
|
|
564
|
+
{ term: 'Pallets', value: '3' },
|
|
565
|
+
{ term: 'Temperature', value: '2 to 6 °C' },
|
|
566
|
+
{ term: 'Hazard class', value: 'None' },
|
|
567
|
+
{ term: 'Stackable', value: 'No' },
|
|
568
|
+
];
|
|
569
|
+
|
|
570
|
+
export default function DescriptionListSizingExample() {
|
|
571
|
+
return (
|
|
572
|
+
<Stack gap={6}>
|
|
573
|
+
<Stack gap={2}>
|
|
574
|
+
<Text size="sm" tone="muted">
|
|
575
|
+
termWidth 8rem, valueAlign end
|
|
576
|
+
</Text>
|
|
577
|
+
<DescriptionList termWidth="8rem" valueAlign="end" variant="ruled">
|
|
578
|
+
{TOTALS.map(({ term, value }) => (
|
|
579
|
+
<DescriptionListItem key={term}>
|
|
580
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
581
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
582
|
+
</DescriptionListItem>
|
|
583
|
+
))}
|
|
584
|
+
</DescriptionList>
|
|
585
|
+
</Stack>
|
|
586
|
+
|
|
587
|
+
<Stack gap={2}>
|
|
588
|
+
<Text size="sm" tone="muted">
|
|
589
|
+
minColumnWidth sm, three columns
|
|
590
|
+
</Text>
|
|
591
|
+
<DescriptionList columns={3} minColumnWidth="sm" termWidth="6rem">
|
|
592
|
+
{SPECS.map(({ term, value }) => (
|
|
593
|
+
<DescriptionListItem key={term}>
|
|
594
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
595
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
596
|
+
</DescriptionListItem>
|
|
597
|
+
))}
|
|
598
|
+
</DescriptionList>
|
|
599
|
+
</Stack>
|
|
600
|
+
</Stack>
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
### variants.tsx
|
|
606
|
+
|
|
607
|
+
Example
|
|
608
|
+
|
|
609
|
+
```tsx
|
|
610
|
+
import {
|
|
611
|
+
DescriptionList,
|
|
612
|
+
DescriptionListDescription,
|
|
613
|
+
DescriptionListItem,
|
|
614
|
+
DescriptionListTerm,
|
|
615
|
+
} from '@slotted/react/description-list';
|
|
616
|
+
import { Stack } from '@slotted/react/stack';
|
|
617
|
+
import { Text } from '@slotted/react/typography';
|
|
618
|
+
|
|
619
|
+
const VARIANTS = [
|
|
620
|
+
{ variant: 'plain', label: 'Plain: no box, for inside a card' },
|
|
621
|
+
{ variant: 'ruled', label: 'Ruled: a rule under every pair' },
|
|
622
|
+
{ variant: 'framed', label: 'Framed: an outer frame and a tinted term cell' },
|
|
623
|
+
] as const;
|
|
624
|
+
|
|
625
|
+
const PAIRS = [
|
|
626
|
+
{ term: 'Invoice', value: 'INV-2026-0318' },
|
|
627
|
+
{ term: 'Issued', value: '3 March 2026' },
|
|
628
|
+
{ term: 'Due', value: '2 April 2026' },
|
|
629
|
+
];
|
|
630
|
+
|
|
631
|
+
export default function DescriptionListVariantsExample() {
|
|
632
|
+
return (
|
|
633
|
+
<Stack gap={6}>
|
|
634
|
+
{VARIANTS.map(({ variant, label }) => (
|
|
635
|
+
<Stack key={variant} gap={2}>
|
|
636
|
+
<Text size="sm" tone="muted">
|
|
637
|
+
{label}
|
|
638
|
+
</Text>
|
|
639
|
+
<DescriptionList variant={variant}>
|
|
640
|
+
{PAIRS.map(({ term, value }) => (
|
|
641
|
+
<DescriptionListItem key={term}>
|
|
642
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
643
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
644
|
+
</DescriptionListItem>
|
|
645
|
+
))}
|
|
646
|
+
</DescriptionList>
|
|
647
|
+
</Stack>
|
|
648
|
+
))}
|
|
649
|
+
</Stack>
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
```
|