@ceed/cds 1.29.0 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Overview.md +5 -5
- package/dist/components/Calendar/utils/index.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +4 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +4 -0
- package/dist/components/MonthRangePicker/MonthRangePicker.d.ts +8 -0
- package/dist/components/data-display/Avatar.md +110 -69
- package/dist/components/data-display/Badge.md +91 -39
- package/dist/components/data-display/Chip.md +49 -20
- package/dist/components/data-display/DataTable.md +93 -0
- package/dist/components/data-display/InfoSign.md +12 -0
- package/dist/components/data-display/Table.md +72 -55
- package/dist/components/data-display/Tooltip.md +40 -40
- package/dist/components/data-display/Typography.md +53 -70
- package/dist/components/feedback/Alert.md +88 -72
- package/dist/components/feedback/CircularProgress.md +17 -0
- package/dist/components/feedback/Skeleton.md +17 -0
- package/dist/components/inputs/Button.md +94 -68
- package/dist/components/inputs/ButtonGroup.md +17 -0
- package/dist/components/inputs/Calendar.md +118 -457
- package/dist/components/inputs/Checkbox.md +185 -430
- package/dist/components/inputs/CurrencyInput.md +22 -0
- package/dist/components/inputs/DatePicker.md +59 -5
- package/dist/components/inputs/DateRangePicker.md +46 -5
- package/dist/components/inputs/FilterableCheckboxGroup.md +20 -3
- package/dist/components/inputs/FormControl.md +32 -2
- package/dist/components/inputs/IconButton.md +18 -0
- package/dist/components/inputs/Input.md +198 -136
- package/dist/components/inputs/MonthPicker.md +59 -5
- package/dist/components/inputs/MonthRangePicker.md +44 -5
- package/dist/components/inputs/PercentageInput.md +25 -0
- package/dist/components/inputs/RadioButton.md +23 -0
- package/dist/components/inputs/RadioList.md +20 -1
- package/dist/components/inputs/RadioTileGroup.md +37 -3
- package/dist/components/inputs/Select.md +56 -0
- package/dist/components/inputs/Slider.md +23 -0
- package/dist/components/inputs/Switch.md +20 -0
- package/dist/components/inputs/Textarea.md +32 -8
- package/dist/components/inputs/Uploader/Uploader.md +21 -0
- package/dist/components/layout/Box.md +52 -41
- package/dist/components/layout/Grid.md +87 -81
- package/dist/components/layout/Stack.md +88 -68
- package/dist/components/navigation/Breadcrumbs.md +57 -46
- package/dist/components/navigation/Drawer.md +17 -0
- package/dist/components/navigation/Dropdown.md +13 -0
- package/dist/components/navigation/IconMenuButton.md +17 -0
- package/dist/components/navigation/InsetDrawer.md +130 -292
- package/dist/components/navigation/Link.md +78 -0
- package/dist/components/navigation/Menu.md +17 -0
- package/dist/components/navigation/MenuButton.md +18 -0
- package/dist/components/navigation/Pagination.md +13 -0
- package/dist/components/navigation/Stepper.md +15 -0
- package/dist/components/navigation/Tabs.md +27 -0
- package/dist/components/surfaces/Accordions.md +804 -49
- package/dist/components/surfaces/Card.md +173 -97
- package/dist/components/surfaces/Divider.md +246 -82
- package/dist/components/surfaces/Sheet.md +15 -0
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +99 -39
- package/dist/index.js +99 -39
- package/framer/index.js +1 -1
- package/package.json +1 -1
|
@@ -217,9 +217,7 @@ A controlled example with an external reset button to clear the selected range.
|
|
|
217
217
|
</div>
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
-
##
|
|
221
|
-
|
|
222
|
-
### Fiscal Period Report
|
|
220
|
+
## Fiscal Period Report
|
|
223
221
|
|
|
224
222
|
```tsx
|
|
225
223
|
function FiscalReportSelector() {
|
|
@@ -248,7 +246,7 @@ function FiscalReportSelector() {
|
|
|
248
246
|
}
|
|
249
247
|
```
|
|
250
248
|
|
|
251
|
-
|
|
249
|
+
## Subscription Duration with Month Count
|
|
252
250
|
|
|
253
251
|
```tsx
|
|
254
252
|
function SubscriptionForm() {
|
|
@@ -279,7 +277,7 @@ function SubscriptionForm() {
|
|
|
279
277
|
}
|
|
280
278
|
```
|
|
281
279
|
|
|
282
|
-
|
|
280
|
+
## Year-over-Year Comparison
|
|
283
281
|
|
|
284
282
|
```tsx
|
|
285
283
|
function YearOverYearComparison() {
|
|
@@ -363,6 +361,47 @@ const handleSubmit = () => {
|
|
|
363
361
|
<MonthRangePicker format="YYYY-MM" />
|
|
364
362
|
```
|
|
365
363
|
|
|
364
|
+
## Props and Customization
|
|
365
|
+
|
|
366
|
+
### Key Props
|
|
367
|
+
|
|
368
|
+
| Prop | Type | Default | Description |
|
|
369
|
+
| --------------- | ------------------------------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
370
|
+
| `value` | `string` | - | Selected month range string in `format` (controlled mode) |
|
|
371
|
+
| `defaultValue` | `string` | `''` | Initial month range string (uncontrolled mode) |
|
|
372
|
+
| `onChange` | `(event: { target: { name?, value: string } }) => void` | - | Callback when the month range changes |
|
|
373
|
+
| `format` | `string` | `'YYYY/MM'` | Format of the `value` and `onChange` value |
|
|
374
|
+
| `displayFormat` | `string` | same as `format` | Format displayed in the input field. Supports `MMM` (short month name) and `MMMM` (full month name) tokens |
|
|
375
|
+
| `locale` | `string` | `'default'` | Locale for month names when using `MMM`/`MMMM` tokens in `displayFormat` (BCP 47 format, e.g., `'en-US'`, `'ko-KR'`) |
|
|
376
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
377
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
378
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
379
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
380
|
+
| `disabled` | `boolean` | `false` | Disables the entire component |
|
|
381
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
382
|
+
| `minDate` | `string` | - | Minimum selectable month (in `format`) |
|
|
383
|
+
| `maxDate` | `string` | - | Maximum selectable month (in `format`) |
|
|
384
|
+
| `disableFuture` | `boolean` | `false` | Disables all future months |
|
|
385
|
+
| `disablePast` | `boolean` | `false` | Disables all past months |
|
|
386
|
+
|
|
387
|
+
### Alphabetic Month Tokens (MMM / MMMM)
|
|
388
|
+
|
|
389
|
+
The `displayFormat` prop supports alphabetic month tokens for more human-readable month display:
|
|
390
|
+
|
|
391
|
+
| Token | Output | Example |
|
|
392
|
+
| ------ | ---------------------- | ------------------------------ |
|
|
393
|
+
| `MMM` | Abbreviated month name | `Jan`, `Feb`, `Apr` |
|
|
394
|
+
| `MMMM` | Full month name | `January`, `February`, `April` |
|
|
395
|
+
|
|
396
|
+
When `displayFormat` contains `MMM` or `MMMM`, the input becomes **read-only** and the user must select months through the calendar popup. Use the `locale` prop to control the language of month names.
|
|
397
|
+
|
|
398
|
+
```tsx
|
|
399
|
+
<MonthRangePicker displayFormat="MMM YYYY" locale="en-US" />
|
|
400
|
+
// → "Apr 2026 - May 2026"
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
> **Note**: MonthRangePicker also accepts all Input props (e.g., `size`, `variant`, `color`, `sx`).
|
|
404
|
+
|
|
366
405
|
## Accessibility
|
|
367
406
|
|
|
368
407
|
- The input has `role="textbox"` and the calendar toggle button has `aria-label="Toggle Calendar"` for screen reader identification.
|
|
@@ -277,6 +277,31 @@ function CompletionTracker({ value, onChange }) {
|
|
|
277
277
|
|
|
278
278
|
5. **Handle edge cases**: Consider what happens at boundary values (0%, 100%) and negative percentages if allowed.
|
|
279
279
|
|
|
280
|
+
## Props and Customization
|
|
281
|
+
|
|
282
|
+
### Key Props
|
|
283
|
+
|
|
284
|
+
| Prop | Type | Default | Description |
|
|
285
|
+
| ----------------- | -------------------------------------------------------- | ------- | ------------------------------------------------------ |
|
|
286
|
+
| `value` | `number` | - | Percentage value (controlled mode) |
|
|
287
|
+
| `defaultValue` | `number` | - | Initial percentage value (uncontrolled mode) |
|
|
288
|
+
| `onChange` | `(event: { target: { name?, value?: number } }) => void` | - | Callback when the value changes |
|
|
289
|
+
| `useMinorUnit` | `boolean` | `false` | When true, value is in basis points (e.g., 1000 = 10%) |
|
|
290
|
+
| `maxDecimalScale` | `number` | `0` | Maximum number of decimal places |
|
|
291
|
+
| `min` | `number` | - | Minimum allowed percentage value |
|
|
292
|
+
| `max` | `number` | - | Maximum allowed percentage value |
|
|
293
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
294
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
295
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
296
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
297
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
298
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
299
|
+
| `placeholder` | `string` | - | Placeholder text when the input is empty |
|
|
300
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
|
|
301
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
302
|
+
|
|
303
|
+
> **Note**: PercentageInput also accepts all Input props and Framer Motion props.
|
|
304
|
+
|
|
280
305
|
## Accessibility
|
|
281
306
|
|
|
282
307
|
- The input has proper labeling via the `label` prop, linked with `aria-labelledby`.
|
|
@@ -470,6 +470,29 @@ function ShippingOptions() {
|
|
|
470
470
|
|
|
471
471
|
5. **Use vertical layout by default**: Vertical lists are easier to scan. Only use horizontal (`orientation="horizontal"`) when options are very short (e.g., segmented controls).
|
|
472
472
|
|
|
473
|
+
## Props and Customization
|
|
474
|
+
|
|
475
|
+
### Key Props
|
|
476
|
+
|
|
477
|
+
| Prop | Type | Default | Description |
|
|
478
|
+
| ---------------- | -------------------------------------------------------------- | ------------ | --------------------------------------------- |
|
|
479
|
+
| `checked` | `boolean` | - | Whether the radio is selected (controlled) |
|
|
480
|
+
| `defaultChecked` | `boolean` | `false` | Initial selected state (uncontrolled) |
|
|
481
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when the state changes |
|
|
482
|
+
| `label` | `ReactNode` | - | Label content displayed next to the radio |
|
|
483
|
+
| `value` | `string` | - | Value attribute for form submission |
|
|
484
|
+
| `name` | `string` | - | Groups radios together for mutual exclusivity |
|
|
485
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
486
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Radio button size |
|
|
487
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'outlined'` | Visual style |
|
|
488
|
+
| `disabled` | `boolean` | `false` | Disables the radio button |
|
|
489
|
+
| `overlay` | `boolean` | `false` | Extends clickable area to parent container |
|
|
490
|
+
| `disableIcon` | `boolean` | `false` | Hides the radio icon |
|
|
491
|
+
| `checkedIcon` | `ReactNode` | - | Custom icon for the checked state |
|
|
492
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
493
|
+
|
|
494
|
+
> **Note**: RadioButton also accepts all Joy UI Radio props and Framer Motion props.
|
|
495
|
+
|
|
473
496
|
## Accessibility
|
|
474
497
|
|
|
475
498
|
- **Keyboard navigation**: Users can move between options using `Arrow Up` / `Arrow Down` (vertical) or `Arrow Left` / `Arrow Right` (horizontal). `Space` selects the focused option.
|
|
@@ -165,7 +165,7 @@ function LanguageSetting() {
|
|
|
165
165
|
<RadioList
|
|
166
166
|
items={[
|
|
167
167
|
{ label: 'English', value: 'en' },
|
|
168
|
-
{ label: '
|
|
168
|
+
{ label: 'Korean', value: 'ko' },
|
|
169
169
|
{ label: '日本語', value: 'ja' },
|
|
170
170
|
]}
|
|
171
171
|
value={language}
|
|
@@ -233,6 +233,25 @@ function RoleSelector({ roles }: { roles: { id: string; name: string }[] }) {
|
|
|
233
233
|
|
|
234
234
|
5. **Use horizontal layout sparingly**: Horizontal orientation works well for 2–4 short options. For longer lists, vertical is more readable.
|
|
235
235
|
|
|
236
|
+
## Props and Customization
|
|
237
|
+
|
|
238
|
+
### Key Props
|
|
239
|
+
|
|
240
|
+
| Prop | Type | Default | Description |
|
|
241
|
+
| -------------- | -------------------------------------------------------------- | ------------ | ------------------------------------------ |
|
|
242
|
+
| `items` | `{ label: ReactNode; value: string }[]` | (required) | Array of radio options |
|
|
243
|
+
| `value` | `string` | - | Selected value (controlled mode) |
|
|
244
|
+
| `defaultValue` | `string` | - | Initial selected value (uncontrolled mode) |
|
|
245
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when selection changes |
|
|
246
|
+
| `name` | `string` | - | Groups radios together for form submission |
|
|
247
|
+
| `disabled` | `boolean` | `false` | Disables all radio buttons |
|
|
248
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'vertical'` | Layout orientation |
|
|
249
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Radio button size |
|
|
250
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
251
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
252
|
+
|
|
253
|
+
> **Note**: RadioList also accepts all Joy UI RadioGroup props.
|
|
254
|
+
|
|
236
255
|
## Accessibility
|
|
237
256
|
|
|
238
257
|
- RadioList renders a `<RadioGroup>` with `role="radiogroup"`, and each option is a `<Radio>` with `role="radio"`.
|
|
@@ -6,10 +6,10 @@ RadioTileGroup is a selection component that displays radio options as visually
|
|
|
6
6
|
|
|
7
7
|
The component supports flexible layouts (horizontal, grid, vertical), icons via `startDecorator`, three sizes, and built-in form integration with `label`, `helperText`, `error`, and `required` props. It works in both controlled and uncontrolled modes.
|
|
8
8
|
|
|
9
|
-
> **
|
|
9
|
+
> **Using built-in props is recommended when building forms**
|
|
10
10
|
>
|
|
11
|
-
>
|
|
12
|
-
>
|
|
11
|
+
> This component provides built-in form-related props such as `label` and `helperText`.
|
|
12
|
+
> When building a form, use the component's built-in props instead of creating separate labels or helper text with Typography.
|
|
13
13
|
|
|
14
14
|
```tsx
|
|
15
15
|
<RadioTileGroup
|
|
@@ -499,6 +499,40 @@ Use a vertical layout with `columns={1}` for plan or tier selection.
|
|
|
499
499
|
|
|
500
500
|
5. **Always provide an error message.** When `error` is true, update `helperText` to explain the validation issue so users know how to fix it.
|
|
501
501
|
|
|
502
|
+
## Props and Customization
|
|
503
|
+
|
|
504
|
+
### Key Props
|
|
505
|
+
|
|
506
|
+
| Prop | Type | Default | Description |
|
|
507
|
+
| -------------- | ------------------------------------------------ | ---------- | ------------------------------------------ |
|
|
508
|
+
| `options` | `RadioTileOption[]` | (required) | Array of radio tile options |
|
|
509
|
+
| `value` | `T` | - | Selected value (controlled mode) |
|
|
510
|
+
| `defaultValue` | `T` | - | Initial selected value (uncontrolled mode) |
|
|
511
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when selection changes |
|
|
512
|
+
| `name` | `string` | - | Groups radios together for form submission |
|
|
513
|
+
| `label` | `ReactNode` | - | Group label displayed above the tiles |
|
|
514
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the tiles |
|
|
515
|
+
| `error` | `boolean` | `false` | Applies error styling |
|
|
516
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
517
|
+
| `disabled` | `boolean` | `false` | Disables all radio tiles |
|
|
518
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'sm'` | Tile size |
|
|
519
|
+
| `flex` | `boolean` | `false` | Tiles stretch to fill available width |
|
|
520
|
+
| `columns` | `number` | - | Fixed number of columns in grid layout |
|
|
521
|
+
| `textAlign` | `'start' \| 'center'` | `'center'` | Text alignment within tiles |
|
|
522
|
+
| `useIndicator` | `boolean` | `false` | Shows a radio indicator on each tile |
|
|
523
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
524
|
+
|
|
525
|
+
### RadioTileOption
|
|
526
|
+
|
|
527
|
+
```tsx
|
|
528
|
+
interface RadioTileOption<T = string> {
|
|
529
|
+
value: T;
|
|
530
|
+
label: ReactNode;
|
|
531
|
+
disabled?: boolean;
|
|
532
|
+
startDecorator?: ReactNode;
|
|
533
|
+
}
|
|
534
|
+
```
|
|
535
|
+
|
|
502
536
|
## Accessibility
|
|
503
537
|
|
|
504
538
|
- RadioTileGroup renders a `<fieldset>` with a `<legend>` derived from the `label` prop, providing proper grouping for screen readers.
|
|
@@ -544,6 +544,62 @@ function LocationSelect() {
|
|
|
544
544
|
</FormControl>
|
|
545
545
|
```
|
|
546
546
|
|
|
547
|
+
## Props and Customization
|
|
548
|
+
|
|
549
|
+
### Key Props
|
|
550
|
+
|
|
551
|
+
| Prop | Type | Default | Description |
|
|
552
|
+
| ---------------- | ---------------------------------------------------------------- | ----------------- | ---------------------------------------------------- |
|
|
553
|
+
| `options` | `OptionType[]` | `[]` | Array of options (objects or primitives) |
|
|
554
|
+
| `value` | `InferOptionValue<OptionType> \| InferOptionValue<OptionType>[]` | - | Selected value(s) for controlled mode |
|
|
555
|
+
| `defaultValue` | `InferOptionValue<OptionType> \| InferOptionValue<OptionType>[]` | - | Initial value for uncontrolled mode |
|
|
556
|
+
| `onChange` | `(event: { target: { name?, value } }, newValue) => void` | - | Callback when selection changes |
|
|
557
|
+
| `multiple` | `boolean` | `false` | Allow multiple selections (value becomes an array) |
|
|
558
|
+
| `label` | `string` | - | Form label displayed above the select |
|
|
559
|
+
| `helperText` | `string` | - | Helper text displayed below the select |
|
|
560
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
561
|
+
| `required` | `boolean` | `false` | Marks the field as required (adds asterisk to label) |
|
|
562
|
+
| `disabled` | `boolean` | `false` | Disables the select |
|
|
563
|
+
| `placeholder` | `string` | `'Choose one...'` | Placeholder text when no value is selected |
|
|
564
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Select size |
|
|
565
|
+
| `variant` | `'outlined' \| 'plain' \| 'solid' \| 'soft'` | `'outlined'` | Visual style variant |
|
|
566
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
567
|
+
| `startDecorator` | `ReactNode` | - | Content rendered before the select trigger text |
|
|
568
|
+
| `endDecorator` | `ReactNode` | - | Content rendered after the select trigger text |
|
|
569
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
570
|
+
|
|
571
|
+
### Option Type
|
|
572
|
+
|
|
573
|
+
Options can be objects or primitives:
|
|
574
|
+
|
|
575
|
+
```tsx
|
|
576
|
+
type OptionType =
|
|
577
|
+
| { label: string; value: string | number; disabled?: boolean; secondaryText?: string }
|
|
578
|
+
| string
|
|
579
|
+
| number;
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
### Generic Type Support
|
|
583
|
+
|
|
584
|
+
Select supports TypeScript generics for type-safe value handling:
|
|
585
|
+
|
|
586
|
+
```tsx
|
|
587
|
+
// Type-safe with object options
|
|
588
|
+
const options = [
|
|
589
|
+
{ value: 1, label: 'Option 1' },
|
|
590
|
+
{ value: 2, label: 'Option 2' },
|
|
591
|
+
] as const;
|
|
592
|
+
|
|
593
|
+
<Select<typeof options[number], false>
|
|
594
|
+
options={options}
|
|
595
|
+
onChange={(e, val) => {
|
|
596
|
+
// val is typed as number
|
|
597
|
+
}}
|
|
598
|
+
/>
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
> **Note**: Select also accepts all Joy UI Select props.
|
|
602
|
+
|
|
547
603
|
## Accessibility
|
|
548
604
|
|
|
549
605
|
- **Label association**: When you use the `label` prop, the component automatically connects the label to the select element via `aria-labelledby`. Always provide a label for screen reader users.
|
|
@@ -326,6 +326,29 @@ function TemperatureSetting() {
|
|
|
326
326
|
|
|
327
327
|
5. **Set a reasonable `step`**: For large ranges (0–1000), use a step > 1 to prevent overwhelming precision. For small ranges (0–1), use decimal steps.
|
|
328
328
|
|
|
329
|
+
## Props and Customization
|
|
330
|
+
|
|
331
|
+
### Key Props
|
|
332
|
+
|
|
333
|
+
| Prop | Type | Default | Description |
|
|
334
|
+
| ------------------- | -------------------------------------------------------------- | -------------- | --------------------------------------------------- |
|
|
335
|
+
| `value` | `number \| number[]` | - | Current value (controlled). Array for range sliders |
|
|
336
|
+
| `defaultValue` | `number \| number[]` | `0` | Initial value (uncontrolled) |
|
|
337
|
+
| `onChange` | `(event: Event, value: number \| number[]) => void` | - | Callback when the value changes |
|
|
338
|
+
| `min` | `number` | `0` | Minimum allowed value |
|
|
339
|
+
| `max` | `number` | `100` | Maximum allowed value |
|
|
340
|
+
| `step` | `number` | `1` | Step increment between values |
|
|
341
|
+
| `marks` | `boolean \| { value: number; label?: string }[]` | `false` | Show marks on the slider track |
|
|
342
|
+
| `valueLabelDisplay` | `'on' \| 'off' \| 'auto'` | `'auto'` | When to display the value label |
|
|
343
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Slider orientation |
|
|
344
|
+
| `disabled` | `boolean` | `false` | Disables the slider |
|
|
345
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Slider size |
|
|
346
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'primary'` | Color scheme |
|
|
347
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
348
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
349
|
+
|
|
350
|
+
> **Note**: Slider also accepts all Joy UI Slider props.
|
|
351
|
+
|
|
329
352
|
## Accessibility
|
|
330
353
|
|
|
331
354
|
- Slider renders with `role="slider"` and appropriate `aria-valuemin`, `aria-valuemax`, and `aria-valuenow` attributes.
|
|
@@ -329,6 +329,26 @@ function FeatureToggle() {
|
|
|
329
329
|
|
|
330
330
|
5. **Group related switches logically**: Place related switches under a shared heading and use consistent spacing to create a scannable settings layout.
|
|
331
331
|
|
|
332
|
+
## Props and Customization
|
|
333
|
+
|
|
334
|
+
### Key Props
|
|
335
|
+
|
|
336
|
+
| Prop | Type | Default | Description |
|
|
337
|
+
| ---------------- | -------------------------------------------------------------- | ----------- | ------------------------------------- |
|
|
338
|
+
| `checked` | `boolean` | - | Whether the switch is on (controlled) |
|
|
339
|
+
| `defaultChecked` | `boolean` | `false` | Initial state (uncontrolled) |
|
|
340
|
+
| `onChange` | `(event: ChangeEvent<HTMLInputElement>) => void` | - | Callback when the state changes |
|
|
341
|
+
| `disabled` | `boolean` | `false` | Disables the switch |
|
|
342
|
+
| `readOnly` | `boolean` | `false` | Makes the switch read-only |
|
|
343
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme when checked |
|
|
344
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Switch size |
|
|
345
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'solid'` | Visual style |
|
|
346
|
+
| `startDecorator` | `ReactNode` | - | Content rendered before the switch |
|
|
347
|
+
| `endDecorator` | `ReactNode` | - | Content rendered after the switch |
|
|
348
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
349
|
+
|
|
350
|
+
> **Note**: Switch also accepts all Joy UI Switch props and Framer Motion props.
|
|
351
|
+
|
|
332
352
|
## Accessibility
|
|
333
353
|
|
|
334
354
|
- **Role and state**: The Switch renders an `<input type="checkbox" role="switch">` with `aria-checked` reflecting the current state. Screen readers announce it as a switch, not a checkbox.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
The Textarea component provides a multi-line text input field for collecting longer-form user input such as comments, descriptions, and notes. It is built on top of Joy UI's Textarea and automatically adjusts its height between `minRows` (default 2) and `maxRows` (default 4) as the user types.
|
|
6
6
|
|
|
7
|
-
Textarea integrates with the form system by wrapping itself in a FormControl, supporting built-in `label`, `helperText`, and `error` props. It also supports decorators, multiple visual variants, sizes, and color themes to fit a wide range of
|
|
7
|
+
Textarea integrates with the form system by wrapping itself in a FormControl, supporting built-in `label`, `helperText`, and `error` props. It also supports decorators, multiple visual variants, sizes, and color themes to fit a wide range of admin UI use cases.
|
|
8
8
|
|
|
9
9
|
> **Use built-in form props**
|
|
10
10
|
>
|
|
@@ -133,28 +133,28 @@ Use the `required`, `label`, and `helperText` props together to build complete f
|
|
|
133
133
|
|
|
134
134
|
## Common Use Cases
|
|
135
135
|
|
|
136
|
-
###
|
|
136
|
+
### Feedback Form
|
|
137
137
|
|
|
138
138
|
```tsx
|
|
139
139
|
import { Textarea, Button, Stack } from '@ceed/cds';
|
|
140
140
|
|
|
141
|
-
function
|
|
141
|
+
function FeedbackForm() {
|
|
142
142
|
const [value, setValue] = React.useState('');
|
|
143
143
|
|
|
144
144
|
return (
|
|
145
145
|
<Stack spacing={2}>
|
|
146
146
|
<Textarea
|
|
147
|
-
name="
|
|
148
|
-
label="
|
|
149
|
-
placeholder="
|
|
150
|
-
helperText="
|
|
147
|
+
name="feedback"
|
|
148
|
+
label="Feedback"
|
|
149
|
+
placeholder="Tell us what you think..."
|
|
150
|
+
helperText="Your feedback helps us improve the service."
|
|
151
151
|
minRows={3}
|
|
152
152
|
maxRows={6}
|
|
153
153
|
value={value}
|
|
154
154
|
onChange={(e) => setValue(e.target.value)}
|
|
155
155
|
required
|
|
156
156
|
/>
|
|
157
|
-
<Button disabled={!value.trim()}>Submit
|
|
157
|
+
<Button disabled={!value.trim()}>Submit</Button>
|
|
158
158
|
</Stack>
|
|
159
159
|
);
|
|
160
160
|
}
|
|
@@ -259,6 +259,30 @@ function ReadOnlyNotes() {
|
|
|
259
259
|
<Textarea placeholder="Type here" />
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
+
## Props and Customization
|
|
263
|
+
|
|
264
|
+
### Key Props
|
|
265
|
+
|
|
266
|
+
| Prop | Type | Default | Description |
|
|
267
|
+
| -------------- | -------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
|
268
|
+
| `label` | `string` | - | Form label displayed above the textarea |
|
|
269
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the textarea |
|
|
270
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
271
|
+
| `minRows` | `number` | `2` | Minimum number of visible text rows |
|
|
272
|
+
| `maxRows` | `number` | `4` | Maximum number of rows before scrolling |
|
|
273
|
+
| `value` | `string` | - | Textarea value for controlled mode |
|
|
274
|
+
| `defaultValue` | `string` | - | Initial value for uncontrolled mode |
|
|
275
|
+
| `onChange` | `(event: ChangeEvent<HTMLTextAreaElement>) => void` | - | Callback when the value changes |
|
|
276
|
+
| `placeholder` | `string` | - | Placeholder text when the textarea is empty |
|
|
277
|
+
| `disabled` | `boolean` | `false` | Disables the textarea |
|
|
278
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
279
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Textarea size |
|
|
280
|
+
| `variant` | `'outlined' \| 'solid' \| 'soft' \| 'plain'` | `'outlined'` | Visual style variant |
|
|
281
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
282
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
283
|
+
|
|
284
|
+
> **Note**: Textarea also accepts all Joy UI Textarea props and Framer Motion props.
|
|
285
|
+
|
|
262
286
|
## Accessibility
|
|
263
287
|
|
|
264
288
|
- The component automatically associates the `label` with the textarea element through FormControl, ensuring screen readers announce the label when the field receives focus.
|
|
@@ -309,6 +309,27 @@ function GalleryUpload({ existingImages }) {
|
|
|
309
309
|
|
|
310
310
|
- **Use `minCount` with form validation.** The minimum count check triggers on form submission, not on file selection. Make sure the Uploader is inside a `<form>` element for this validation to work.
|
|
311
311
|
|
|
312
|
+
## Props and Customization
|
|
313
|
+
|
|
314
|
+
### Key Props
|
|
315
|
+
|
|
316
|
+
| Prop | Type | Default | Description |
|
|
317
|
+
| ------------------ | --------------------------------------------------------- | ---------- | ----------------------------------------------------------- |
|
|
318
|
+
| `accept` | `string` | (required) | Accepted file types (e.g., `'image/*'`, `'.pdf,.doc'`) |
|
|
319
|
+
| `maxFileTotalSize` | `number` | (required) | Maximum total size of all files in bytes |
|
|
320
|
+
| `onChange` | `(event: { target: { name?, value: File[] } }) => void` | - | Callback when files are added |
|
|
321
|
+
| `onDelete` | `(deletedFile: UserUpload) => void` | - | Callback when an uploaded file is removed |
|
|
322
|
+
| `uploaded` | `{ id: string \| number; name: string; size?: number }[]` | - | Pre-existing uploaded files to display |
|
|
323
|
+
| `maxFileSize` | `number` | - | Maximum size per individual file in bytes |
|
|
324
|
+
| `maxCount` | `number` | - | Maximum number of files allowed |
|
|
325
|
+
| `minCount` | `number` | - | Minimum number of files required (validated on form submit) |
|
|
326
|
+
| `label` | `string` | - | Label displayed above the uploader |
|
|
327
|
+
| `helperText` | `string` | - | Helper text displayed below the uploader |
|
|
328
|
+
| `error` | `boolean` | `false` | Applies error styling |
|
|
329
|
+
| `disabled` | `boolean` | `false` | Disables the uploader |
|
|
330
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
331
|
+
| `size` | `'sm' \| 'md'` | `'md'` | Uploader size |
|
|
332
|
+
|
|
312
333
|
## Accessibility
|
|
313
334
|
|
|
314
335
|
- The dropzone is keyboard-accessible and can be activated via **Enter** or **Space** to open the file browser.
|