@ceed/cds 1.34.1 → 1.36.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/components/Accordions/Accordions.d.ts +1 -0
- package/dist/components/Alert/Alert.d.ts +5 -5
- package/dist/components/Autocomplete/Autocomplete.d.ts +2 -2
- package/dist/components/Avatar/Avatar.d.ts +7 -17
- package/dist/components/Box/Box.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +6 -5
- package/dist/components/Button/Button.d.ts +3 -2
- package/dist/components/Calendar/Calendar.d.ts +1 -0
- package/dist/components/Card/Card.d.ts +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/components/Chip/Chip.d.ts +1 -0
- package/dist/components/Container/Container.d.ts +6 -1
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/DialogActions/DialogActions.d.ts +1 -0
- package/dist/components/DialogContent/DialogContent.d.ts +1 -0
- package/dist/components/DialogFrame/DialogFrame.d.ts +1 -1
- package/dist/components/DialogTitle/DialogTitle.d.ts +1 -0
- package/dist/components/Divider/Divider.d.ts +1 -0
- package/dist/components/Drawer/Drawer.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.d.ts +28 -1
- package/dist/components/FormControl/FormControl.d.ts +1 -0
- package/dist/components/FormHelperText/FormHelperText.d.ts +1 -0
- package/dist/components/FormLabel/FormLabel.d.ts +1 -0
- package/dist/components/Grid/Grid.d.ts +1 -0
- package/dist/components/IconButton/IconButton.d.ts +3 -2
- package/dist/components/IconMenuButton/IconMenuButton.d.ts +7 -6
- package/dist/components/InfoSign/InfoSign.d.ts +3 -2
- package/dist/components/Input/Input.d.ts +8 -22
- package/dist/components/InsetDrawer/InsetDrawer.d.ts +1 -0
- package/dist/components/Markdown/Markdown.d.ts +9 -24
- package/dist/components/Menu/Menu.d.ts +2 -1
- package/dist/components/MenuButton/MenuButton.d.ts +10 -8
- package/dist/components/Modal/Modal.d.ts +4 -2
- package/dist/components/NavigationGroup/NavigationGroup.d.ts +3 -2
- package/dist/components/NavigationItem/NavigationItem.d.ts +3 -2
- package/dist/components/Navigator/Navigator.d.ts +5 -4
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -0
- package/dist/components/RadioList/RadioList.d.ts +3 -2
- package/dist/components/Select/Select.d.ts +20 -10
- package/dist/components/Sheet/Sheet.d.ts +1 -0
- package/dist/components/Stack/Stack.d.ts +1 -0
- package/dist/components/Stepper/Stepper.d.ts +2 -1
- package/dist/components/Switch/Switch.d.ts +1 -0
- package/dist/components/Table/Table.d.ts +7 -5
- package/dist/components/Tabs/Tabs.d.ts +1 -0
- package/dist/components/Textarea/Textarea.d.ts +8 -20
- package/dist/components/Tooltip/Tooltip.d.ts +1 -0
- package/dist/components/Typography/Typography.d.ts +1 -0
- package/dist/components/Uploader/Uploader.d.ts +18 -17
- package/dist/components/data-display/Avatar.md +60 -72
- package/dist/components/data-display/Badge.md +197 -181
- package/dist/components/data-display/Chip.md +164 -142
- package/dist/components/data-display/DataTable.md +843 -338
- package/dist/components/data-display/InfoSign.md +1 -3
- package/dist/components/data-display/Markdown.md +93 -125
- package/dist/components/data-display/Table.md +1453 -1007
- package/dist/components/data-display/Typography.md +113 -116
- package/dist/components/feedback/Alert.md +80 -86
- package/dist/components/feedback/CircularProgress.md +32 -36
- package/dist/components/feedback/Dialog.md +25 -17
- package/dist/components/feedback/Modal.md +296 -264
- package/dist/components/feedback/Skeleton.md +125 -89
- package/dist/components/index.d.ts +62 -2
- package/dist/components/inputs/Autocomplete.md +191 -95
- package/dist/components/inputs/Button.md +83 -83
- package/dist/components/inputs/ButtonGroup.md +195 -185
- package/dist/components/inputs/Calendar.md +25 -28
- package/dist/components/inputs/Checkbox.md +11 -29
- package/dist/components/inputs/CurrencyInput.md +4 -4
- package/dist/components/inputs/DatePicker.md +229 -110
- package/dist/components/inputs/DateRangePicker.md +248 -137
- package/dist/components/inputs/FilterableCheckboxGroup.md +115 -55
- package/dist/components/inputs/FormControl.md +75 -69
- package/dist/components/inputs/IconButton.md +229 -205
- package/dist/components/inputs/Input.md +131 -98
- package/dist/components/inputs/MonthPicker.md +186 -84
- package/dist/components/inputs/MonthRangePicker.md +73 -49
- package/dist/components/inputs/PercentageInput.md +15 -31
- package/dist/components/inputs/RadioButton.md +320 -256
- package/dist/components/inputs/RadioList.md +66 -50
- package/dist/components/inputs/RadioTileGroup.md +287 -170
- package/dist/components/inputs/SearchBar.md +82 -60
- package/dist/components/inputs/Select.md +184 -120
- package/dist/components/inputs/Slider.md +153 -102
- package/dist/components/inputs/Switch.md +193 -138
- package/dist/components/inputs/Textarea.md +15 -20
- package/dist/components/inputs/Uploader/Uploader.md +68 -39
- package/dist/components/layout/Box.md +841 -662
- package/dist/components/layout/Container.md +3 -11
- package/dist/components/layout/Grid.md +480 -394
- package/dist/components/layout/Stack.md +739 -566
- package/dist/components/navigation/Breadcrumbs.md +4 -4
- package/dist/components/navigation/Drawer.md +34 -25
- package/dist/components/navigation/Dropdown.md +745 -408
- package/dist/components/navigation/IconMenuButton.md +14 -6
- package/dist/components/navigation/InsetDrawer.md +8 -13
- package/dist/components/navigation/Link.md +1 -2
- package/dist/components/navigation/Menu.md +623 -502
- package/dist/components/navigation/MenuButton.md +18 -10
- package/dist/components/navigation/NavigationGroup.md +19 -50
- package/dist/components/navigation/NavigationItem.md +6 -6
- package/dist/components/navigation/Navigator.md +26 -28
- package/dist/components/navigation/Pagination.md +86 -75
- package/dist/components/navigation/Stepper.md +2 -12
- package/dist/components/navigation/Tabs.md +48 -36
- package/dist/components/surfaces/Accordions.md +89 -172
- package/dist/components/surfaces/Card.md +1094 -709
- package/dist/components/surfaces/Divider.md +562 -412
- package/dist/components/surfaces/Sheet.md +700 -518
- package/dist/guides/ThemeProvider.md +8 -8
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +1074 -1033
- package/dist/index.d.ts +2 -1
- package/dist/index.js +720 -671
- package/framer/index.js +1 -1
- package/package.json +32 -35
|
@@ -27,12 +27,7 @@ import { Switch } from '@ceed/cds';
|
|
|
27
27
|
function MyComponent() {
|
|
28
28
|
const [enabled, setEnabled] = useState(false);
|
|
29
29
|
|
|
30
|
-
return (
|
|
31
|
-
<Switch
|
|
32
|
-
checked={enabled}
|
|
33
|
-
onChange={(e) => setEnabled(e.target.checked)}
|
|
34
|
-
/>
|
|
35
|
-
);
|
|
30
|
+
return <Switch checked={enabled} onChange={(e) => setEnabled(e.target.checked)} />;
|
|
36
31
|
}
|
|
37
32
|
```
|
|
38
33
|
|
|
@@ -41,24 +36,38 @@ function MyComponent() {
|
|
|
41
36
|
Use `FormControl` with `FormLabel` and `FormHelperText` to provide a label and description alongside the switch. The `orientation="horizontal"` layout places the label on the left and the switch on the right.
|
|
42
37
|
|
|
43
38
|
```tsx
|
|
44
|
-
<FormControl
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
<FormControl
|
|
40
|
+
orientation="horizontal"
|
|
41
|
+
sx={{
|
|
42
|
+
width: 300,
|
|
43
|
+
justifyContent: "space-between"
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<div>
|
|
47
|
+
<FormLabel>Show captions</FormLabel>
|
|
48
|
+
<FormHelperText
|
|
49
|
+
sx={{
|
|
50
|
+
mt: 0
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
All languages available.
|
|
54
|
+
</FormHelperText>
|
|
55
|
+
</div>
|
|
56
|
+
<Switch
|
|
57
|
+
checked={checked}
|
|
58
|
+
onChange={(e) => setChecked(e.target.checked)}
|
|
59
|
+
color={checked ? "success" : "neutral"}
|
|
60
|
+
variant={checked ? "solid" : "outlined"}
|
|
61
|
+
endDecorator={checked ? "On" : "Off"}
|
|
62
|
+
slotProps={{
|
|
63
|
+
endDecorator: {
|
|
64
|
+
sx: {
|
|
65
|
+
minWidth: 24
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}}
|
|
69
|
+
/>
|
|
70
|
+
</FormControl>
|
|
62
71
|
```
|
|
63
72
|
|
|
64
73
|
## Inline Labels
|
|
@@ -66,11 +75,18 @@ Use `FormControl` with `FormLabel` and `FormHelperText` to provide a label and d
|
|
|
66
75
|
For simpler cases, wrap the switch inside a `Typography` component rendered as a `<label>`. This connects the text and switch semantically without requiring a `FormControl`.
|
|
67
76
|
|
|
68
77
|
```tsx
|
|
69
|
-
<Typography
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
<Typography
|
|
79
|
+
component="label"
|
|
80
|
+
endDecorator={
|
|
81
|
+
<Switch
|
|
82
|
+
sx={{
|
|
83
|
+
ml: 1
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
}
|
|
87
|
+
>
|
|
88
|
+
Turn alarm on
|
|
89
|
+
</Typography>
|
|
74
90
|
```
|
|
75
91
|
|
|
76
92
|
## With Decorators
|
|
@@ -78,15 +94,30 @@ Turn alarm on
|
|
|
78
94
|
Use `startDecorator` and `endDecorator` to place icons or text around the switch. This is particularly useful for theme toggles or any context where visual cues reinforce the on/off meaning.
|
|
79
95
|
|
|
80
96
|
```tsx
|
|
81
|
-
<Switch
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
<Switch
|
|
98
|
+
color={dark ? "primary" : "danger"}
|
|
99
|
+
slotProps={{
|
|
100
|
+
input: {
|
|
101
|
+
"aria-label": "dark mode"
|
|
102
|
+
}
|
|
103
|
+
}}
|
|
104
|
+
startDecorator={
|
|
105
|
+
<LightModeIcon
|
|
106
|
+
sx={(theme) => ({
|
|
107
|
+
color: dark ? "currentColor" : "var(--ceed-palette-danger-solidBg)"
|
|
108
|
+
})}
|
|
109
|
+
/>
|
|
110
|
+
}
|
|
111
|
+
endDecorator={
|
|
112
|
+
<DarkModeIcon
|
|
113
|
+
sx={(theme) => ({
|
|
114
|
+
color: dark ? "var(--ceed-palette-primary-solidBg)" : "currentColor"
|
|
115
|
+
})}
|
|
116
|
+
/>
|
|
117
|
+
}
|
|
118
|
+
checked={dark}
|
|
119
|
+
onChange={(event) => setDark(event.target.checked)}
|
|
120
|
+
/>
|
|
90
121
|
```
|
|
91
122
|
|
|
92
123
|
## Track Children
|
|
@@ -95,42 +126,62 @@ Display text or symbols inside the switch track using `slotProps.track.children`
|
|
|
95
126
|
|
|
96
127
|
```tsx
|
|
97
128
|
<Stack direction="row" spacing={4}>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
<Switch
|
|
130
|
+
{...args}
|
|
131
|
+
slotProps={{
|
|
132
|
+
track: {
|
|
133
|
+
children: (
|
|
134
|
+
<React.Fragment>
|
|
135
|
+
<Typography
|
|
136
|
+
component="span"
|
|
137
|
+
level="inherit"
|
|
138
|
+
sx={{
|
|
139
|
+
ml: "10px"
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
On
|
|
143
|
+
</Typography>
|
|
144
|
+
<Typography
|
|
145
|
+
component="span"
|
|
146
|
+
level="inherit"
|
|
147
|
+
sx={{
|
|
148
|
+
mr: "8px"
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
151
|
+
Off
|
|
152
|
+
</Typography>
|
|
153
|
+
</React.Fragment>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
}}
|
|
157
|
+
sx={{
|
|
158
|
+
"--Switch-thumbSize": "27px",
|
|
159
|
+
"--Switch-trackWidth": "64px",
|
|
160
|
+
"--Switch-trackHeight": "31px"
|
|
161
|
+
}}
|
|
162
|
+
/>
|
|
163
|
+
<Switch
|
|
164
|
+
color="success"
|
|
165
|
+
slotProps={{
|
|
166
|
+
track: {
|
|
167
|
+
children: (
|
|
168
|
+
<React.Fragment>
|
|
169
|
+
<span>I</span>
|
|
170
|
+
<span>0</span>
|
|
171
|
+
</React.Fragment>
|
|
172
|
+
),
|
|
173
|
+
sx: {
|
|
174
|
+
justifyContent: "space-around"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}}
|
|
178
|
+
sx={{
|
|
179
|
+
"--Switch-thumbSize": "27px",
|
|
180
|
+
"--Switch-trackWidth": "52px",
|
|
181
|
+
"--Switch-trackHeight": "31px"
|
|
182
|
+
}}
|
|
183
|
+
/>
|
|
184
|
+
</Stack>
|
|
134
185
|
```
|
|
135
186
|
|
|
136
187
|
## Thumb Children
|
|
@@ -138,16 +189,20 @@ Display text or symbols inside the switch track using `slotProps.track.children`
|
|
|
138
189
|
Place an icon inside the switch thumb using `slotProps.thumb.children`. This is useful for adding a small visual indicator that moves with the toggle.
|
|
139
190
|
|
|
140
191
|
```tsx
|
|
141
|
-
<Switch
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}}
|
|
192
|
+
<Switch
|
|
193
|
+
size="lg"
|
|
194
|
+
slotProps={{
|
|
195
|
+
input: {
|
|
196
|
+
"aria-label": "Dark mode"
|
|
197
|
+
},
|
|
198
|
+
thumb: {
|
|
199
|
+
children: <DarkModeIcon fontSize="inherit" />
|
|
200
|
+
}
|
|
201
|
+
}}
|
|
202
|
+
sx={{
|
|
203
|
+
"--Switch-thumbSize": "16px"
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
151
206
|
```
|
|
152
207
|
|
|
153
208
|
## All Variants Overview
|
|
@@ -156,38 +211,54 @@ A comprehensive view of all color and decoration combinations.
|
|
|
156
211
|
|
|
157
212
|
```tsx
|
|
158
213
|
<Stack direction="row" spacing={4}>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
214
|
+
{([undefined, "primary", "warning", "success", "danger", "neutral"] as const).map((color) => (
|
|
215
|
+
<Stack key={color} spacing={2}>
|
|
216
|
+
<Switch color={color} />
|
|
217
|
+
<Switch color={color} checked />
|
|
218
|
+
<Switch color={color} startDecorator={<LightModeIcon />} endDecorator={<DarkModeIcon />} />
|
|
219
|
+
<Switch
|
|
220
|
+
color={color}
|
|
221
|
+
slotProps={{
|
|
222
|
+
input: {
|
|
223
|
+
"aria-label": "Dark mode"
|
|
224
|
+
},
|
|
225
|
+
thumb: {
|
|
226
|
+
children: <DarkModeIcon fontSize="inherit" />
|
|
227
|
+
},
|
|
228
|
+
track: {
|
|
229
|
+
children: (
|
|
230
|
+
<React.Fragment>
|
|
231
|
+
<span>I</span>
|
|
232
|
+
<span>0</span>
|
|
233
|
+
</React.Fragment>
|
|
234
|
+
),
|
|
235
|
+
sx: {
|
|
236
|
+
justifyContent: "space-around"
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}}
|
|
240
|
+
sx={{
|
|
241
|
+
"--Switch-thumbSize": "27px",
|
|
242
|
+
"--Switch-trackWidth": "52px",
|
|
243
|
+
"--Switch-trackHeight": "31px"
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
<Typography
|
|
247
|
+
component="label"
|
|
248
|
+
startDecorator={
|
|
249
|
+
<Switch
|
|
250
|
+
sx={{
|
|
251
|
+
ml: 1
|
|
252
|
+
}}
|
|
253
|
+
color={color}
|
|
254
|
+
/>
|
|
255
|
+
}
|
|
256
|
+
>
|
|
257
|
+
Label
|
|
258
|
+
</Typography>
|
|
259
|
+
</Stack>
|
|
260
|
+
))}
|
|
261
|
+
</Stack>
|
|
191
262
|
```
|
|
192
263
|
|
|
193
264
|
## Common Use Cases
|
|
@@ -201,15 +272,10 @@ function SettingsPanel() {
|
|
|
201
272
|
|
|
202
273
|
return (
|
|
203
274
|
<Stack spacing={3}>
|
|
204
|
-
<FormControl
|
|
205
|
-
orientation="horizontal"
|
|
206
|
-
sx={{ width: 400, justifyContent: 'space-between' }}
|
|
207
|
-
>
|
|
275
|
+
<FormControl orientation="horizontal" sx={{ width: 400, justifyContent: 'space-between' }}>
|
|
208
276
|
<div>
|
|
209
277
|
<FormLabel>Notifications</FormLabel>
|
|
210
|
-
<FormHelperText sx={{ mt: 0 }}>
|
|
211
|
-
Receive alerts when new messages arrive.
|
|
212
|
-
</FormHelperText>
|
|
278
|
+
<FormHelperText sx={{ mt: 0 }}>Receive alerts when new messages arrive.</FormHelperText>
|
|
213
279
|
</div>
|
|
214
280
|
<Switch
|
|
215
281
|
checked={notifications}
|
|
@@ -218,20 +284,12 @@ function SettingsPanel() {
|
|
|
218
284
|
/>
|
|
219
285
|
</FormControl>
|
|
220
286
|
|
|
221
|
-
<FormControl
|
|
222
|
-
orientation="horizontal"
|
|
223
|
-
sx={{ width: 400, justifyContent: 'space-between' }}
|
|
224
|
-
>
|
|
287
|
+
<FormControl orientation="horizontal" sx={{ width: 400, justifyContent: 'space-between' }}>
|
|
225
288
|
<div>
|
|
226
289
|
<FormLabel>Auto Save</FormLabel>
|
|
227
|
-
<FormHelperText sx={{ mt: 0 }}>
|
|
228
|
-
Automatically save your work every 30 seconds.
|
|
229
|
-
</FormHelperText>
|
|
290
|
+
<FormHelperText sx={{ mt: 0 }}>Automatically save your work every 30 seconds.</FormHelperText>
|
|
230
291
|
</div>
|
|
231
|
-
<Switch
|
|
232
|
-
checked={autoSave}
|
|
233
|
-
onChange={(e) => setAutoSave(e.target.checked)}
|
|
234
|
-
/>
|
|
292
|
+
<Switch checked={autoSave} onChange={(e) => setAutoSave(e.target.checked)} />
|
|
235
293
|
</FormControl>
|
|
236
294
|
</Stack>
|
|
237
295
|
);
|
|
@@ -266,10 +324,7 @@ function FeatureToggle() {
|
|
|
266
324
|
const [betaEnabled, setBetaEnabled] = useState(false);
|
|
267
325
|
|
|
268
326
|
return (
|
|
269
|
-
<FormControl
|
|
270
|
-
orientation="horizontal"
|
|
271
|
-
sx={{ justifyContent: 'space-between' }}
|
|
272
|
-
>
|
|
327
|
+
<FormControl orientation="horizontal" sx={{ justifyContent: 'space-between' }}>
|
|
273
328
|
<FormLabel>Enable Beta Features</FormLabel>
|
|
274
329
|
<Switch
|
|
275
330
|
checked={betaEnabled}
|
|
@@ -56,11 +56,11 @@ Textarea supports four visual variants: `solid`, `soft`, `outlined`, and `plain`
|
|
|
56
56
|
|
|
57
57
|
```tsx
|
|
58
58
|
<>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</>
|
|
59
|
+
<Textarea name="Solid" placeholder="Type in here…" variant="solid" />
|
|
60
|
+
<Textarea name="Soft" placeholder="Type in here…" variant="soft" />
|
|
61
|
+
<Textarea name="Outlined" placeholder="Type in here…" variant="outlined" />
|
|
62
|
+
<Textarea name="Plain" placeholder="Type in here…" variant="plain" />
|
|
63
|
+
</>
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
```tsx
|
|
@@ -76,10 +76,10 @@ Textarea comes in three sizes: `sm`, `md`, and `lg`. The default size is `md`.
|
|
|
76
76
|
|
|
77
77
|
```tsx
|
|
78
78
|
<>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</>
|
|
79
|
+
<Textarea size="sm" name="Size" placeholder="Small" />
|
|
80
|
+
<Textarea size="md" name="Size" placeholder="Medium" />
|
|
81
|
+
<Textarea size="lg" name="Size" placeholder="Large" />
|
|
82
|
+
</>
|
|
83
83
|
```
|
|
84
84
|
|
|
85
85
|
```tsx
|
|
@@ -94,11 +94,11 @@ Textarea supports semantic colors via the `color` prop: `primary`, `neutral`, `d
|
|
|
94
94
|
|
|
95
95
|
```tsx
|
|
96
96
|
<>
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</>
|
|
97
|
+
<Textarea name="Primary" placeholder="Type in here…" variant="outlined" color="primary" />
|
|
98
|
+
<Textarea name="Neutral" placeholder="Type in here…" variant="outlined" color="neutral" />
|
|
99
|
+
<Textarea name="Danger" placeholder="Type in here…" variant="outlined" color="danger" />
|
|
100
|
+
<Textarea name="Warning" placeholder="Type in here…" variant="outlined" color="warning" />
|
|
101
|
+
</>
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
```tsx
|
|
@@ -123,12 +123,7 @@ Use the `required`, `label`, and `helperText` props together to build complete f
|
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
```tsx
|
|
126
|
-
<Textarea
|
|
127
|
-
label="Label"
|
|
128
|
-
helperText="I'm helper text"
|
|
129
|
-
placeholder="Type in here..."
|
|
130
|
-
required
|
|
131
|
-
/>
|
|
126
|
+
<Textarea label="Label" helperText="I'm helper text" placeholder="Type in here..." required />
|
|
132
127
|
```
|
|
133
128
|
|
|
134
129
|
## Common Use Cases
|
|
@@ -75,15 +75,15 @@ Two sizes are available: `sm` and `md`. Use the smaller size for compact form la
|
|
|
75
75
|
|
|
76
76
|
```tsx
|
|
77
77
|
<Stack gap={4}>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
<Stack gap={2}>
|
|
79
|
+
<Typography level="title-sm">SM</Typography>
|
|
80
|
+
<Uploader {...args} size="sm" />
|
|
81
|
+
</Stack>
|
|
82
|
+
<Stack gap={2}>
|
|
83
|
+
<Typography level="title-sm">MD</Typography>
|
|
84
|
+
<Uploader {...args} size="md" />
|
|
85
|
+
</Stack>
|
|
81
86
|
</Stack>
|
|
82
|
-
<Stack gap={2}>
|
|
83
|
-
<Typography level="title-sm">MD</Typography>
|
|
84
|
-
<Uploader {...args} size="md" />
|
|
85
|
-
</Stack>
|
|
86
|
-
</Stack>
|
|
87
87
|
```
|
|
88
88
|
|
|
89
89
|
## File Type Restriction (Accepts)
|
|
@@ -103,16 +103,18 @@ The `minCount` prop sets a minimum number of required files. Validation triggers
|
|
|
103
103
|
|
|
104
104
|
```tsx
|
|
105
105
|
<>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
</
|
|
115
|
-
|
|
106
|
+
<form
|
|
107
|
+
onSubmit={(e) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
console.log("Submitted");
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<Stack gap={2}>
|
|
113
|
+
<Uploader {...args} />
|
|
114
|
+
<Button type="submit">Submit</Button>
|
|
115
|
+
</Stack>
|
|
116
|
+
</form>
|
|
117
|
+
</>
|
|
116
118
|
```
|
|
117
119
|
|
|
118
120
|
## With Uploaded Files
|
|
@@ -184,15 +186,17 @@ Demonstrates automatic validation error messages for various rule violations (fi
|
|
|
184
186
|
|
|
185
187
|
```tsx
|
|
186
188
|
<Stack gap={4}>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
189
|
+
<Stack gap={2}>
|
|
190
|
+
<Typography level="title-sm">Try uploading files that violate validation rules:</Typography>
|
|
191
|
+
<Typography level="body-sm">
|
|
192
|
+
• Upload a file larger than 500KB (individual file size limit)
|
|
193
|
+
</Typography>
|
|
194
|
+
<Typography level="body-sm">• Upload multiple files exceeding 1MB total</Typography>
|
|
195
|
+
<Typography level="body-sm">• Upload more than 2 files</Typography>
|
|
196
|
+
<Typography level="body-sm">• Upload non-PNG/JPG files</Typography>
|
|
197
|
+
</Stack>
|
|
198
|
+
<Uploader {...args} />
|
|
193
199
|
</Stack>
|
|
194
|
-
<Uploader {...args} />
|
|
195
|
-
</Stack>
|
|
196
200
|
```
|
|
197
201
|
|
|
198
202
|
## Helper Text Variations
|
|
@@ -201,19 +205,40 @@ Comparison of auto-generated helper text, custom helper text, and error-state he
|
|
|
201
205
|
|
|
202
206
|
```tsx
|
|
203
207
|
<Stack gap={4}>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
<
|
|
208
|
+
<Stack gap={2}>
|
|
209
|
+
<Typography level="title-sm">Default Helper Text (Generated)</Typography>
|
|
210
|
+
<Uploader
|
|
211
|
+
{...args}
|
|
212
|
+
label="Default helper text"
|
|
213
|
+
accept=".png,.jpg,.pdf"
|
|
214
|
+
maxFileTotalSize={5 * 1024 * 1024}
|
|
215
|
+
maxCount={3}
|
|
216
|
+
/>
|
|
217
|
+
</Stack>
|
|
218
|
+
<Stack gap={2}>
|
|
219
|
+
<Typography level="title-sm">Custom Helper Text</Typography>
|
|
220
|
+
<Uploader
|
|
221
|
+
{...args}
|
|
222
|
+
label="Custom helper text"
|
|
223
|
+
accept=".png,.jpg,.pdf"
|
|
224
|
+
maxFileTotalSize={5 * 1024 * 1024}
|
|
225
|
+
maxCount={3}
|
|
226
|
+
helperText="Please upload your profile documents (PNG, JPG, or PDF only)"
|
|
227
|
+
/>
|
|
228
|
+
</Stack>
|
|
229
|
+
<Stack gap={2}>
|
|
230
|
+
<Typography level="title-sm">Error State with Custom Helper Text</Typography>
|
|
231
|
+
<Uploader
|
|
232
|
+
{...args}
|
|
233
|
+
label="Error state"
|
|
234
|
+
accept=".png,.jpg,.pdf"
|
|
235
|
+
maxFileTotalSize={5 * 1024 * 1024}
|
|
236
|
+
maxCount={3}
|
|
237
|
+
error={true}
|
|
238
|
+
helperText="There was an error processing your files. Please try again."
|
|
239
|
+
/>
|
|
240
|
+
</Stack>
|
|
215
241
|
</Stack>
|
|
216
|
-
</Stack>
|
|
217
242
|
```
|
|
218
243
|
|
|
219
244
|
## Disabled State
|
|
@@ -257,7 +282,11 @@ import { Uploader, Stack, Button } from '@ceed/cds';
|
|
|
257
282
|
|
|
258
283
|
function DocumentForm() {
|
|
259
284
|
return (
|
|
260
|
-
<form
|
|
285
|
+
<form
|
|
286
|
+
onSubmit={(e) => {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
}}
|
|
289
|
+
>
|
|
261
290
|
<Stack gap={3}>
|
|
262
291
|
<Uploader
|
|
263
292
|
label="Supporting Documents"
|