@ceed/cds 1.28.1 → 1.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Overview.md +5 -5
- package/dist/components/DatePicker/DatePicker.d.ts +10 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +10 -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 +84 -0
- package/dist/components/inputs/DateRangePicker.md +88 -0
- package/dist/components/inputs/FilterableCheckboxGroup.md +20 -3
- package/dist/components/inputs/FormControl.md +32 -2
- package/dist/components/inputs/IconButton.md +18 -0
- package/dist/components/inputs/Input.md +198 -136
- package/dist/components/inputs/MonthPicker.md +25 -0
- package/dist/components/inputs/MonthRangePicker.md +23 -0
- package/dist/components/inputs/PercentageInput.md +25 -0
- package/dist/components/inputs/RadioButton.md +23 -0
- package/dist/components/inputs/RadioList.md +20 -1
- package/dist/components/inputs/RadioTileGroup.md +37 -3
- package/dist/components/inputs/Select.md +56 -0
- package/dist/components/inputs/Slider.md +23 -0
- package/dist/components/inputs/Switch.md +20 -0
- package/dist/components/inputs/Textarea.md +32 -8
- package/dist/components/inputs/Uploader/Uploader.md +21 -0
- package/dist/components/layout/Box.md +52 -41
- package/dist/components/layout/Grid.md +87 -81
- package/dist/components/layout/Stack.md +88 -68
- package/dist/components/navigation/Breadcrumbs.md +57 -46
- package/dist/components/navigation/Drawer.md +17 -0
- package/dist/components/navigation/Dropdown.md +13 -0
- package/dist/components/navigation/IconMenuButton.md +17 -0
- package/dist/components/navigation/InsetDrawer.md +130 -292
- package/dist/components/navigation/Link.md +78 -0
- package/dist/components/navigation/Menu.md +17 -0
- package/dist/components/navigation/MenuButton.md +18 -0
- package/dist/components/navigation/Pagination.md +13 -0
- package/dist/components/navigation/Stepper.md +15 -0
- package/dist/components/navigation/Tabs.md +27 -0
- package/dist/components/surfaces/Accordions.md +804 -49
- package/dist/components/surfaces/Card.md +173 -97
- package/dist/components/surfaces/Divider.md +246 -82
- package/dist/components/surfaces/Sheet.md +15 -0
- package/dist/index.browser.js +2 -2
- package/dist/index.browser.js.map +3 -3
- package/dist/index.cjs +173 -6
- package/dist/index.js +173 -6
- package/framer/index.js +1 -1
- package/package.json +1 -1
|
@@ -261,6 +261,28 @@ function BudgetSetting() {
|
|
|
261
261
|
|
|
262
262
|
5. **Handle negative values carefully**: CurrencyInput supports negative values. If negatives are not valid for your use case, validate in `onChange`.
|
|
263
263
|
|
|
264
|
+
## Props and Customization
|
|
265
|
+
|
|
266
|
+
### Key Props
|
|
267
|
+
|
|
268
|
+
| Prop | Type | Default | Description |
|
|
269
|
+
| -------------- | -------------------------------------------------------- | ------- | -------------------------------------------------------- |
|
|
270
|
+
| `value` | `number` | - | Currency value (controlled mode) |
|
|
271
|
+
| `defaultValue` | `number` | - | Initial currency value (uncontrolled mode) |
|
|
272
|
+
| `onChange` | `(event: { target: { name?, value?: number } }) => void` | - | Callback when the value changes |
|
|
273
|
+
| `currency` | `'USD' \| 'KRW' \| 'CAD'` | `'USD'` | Currency code (determines symbol and formatting) |
|
|
274
|
+
| `useMinorUnit` | `boolean` | `false` | When true, value is in minor units (e.g., cents for USD) |
|
|
275
|
+
| `max` | `number` | - | Maximum allowed value |
|
|
276
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
277
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
278
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
279
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
280
|
+
| `disabled` | `boolean` | `false` | Disables the input |
|
|
281
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
282
|
+
| `placeholder` | `string` | - | Placeholder text when the input is empty |
|
|
283
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Input size |
|
|
284
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
285
|
+
|
|
264
286
|
## Accessibility
|
|
265
287
|
|
|
266
288
|
- The input has `role="textbox"` with proper labeling via the `label` prop.
|
|
@@ -256,6 +256,54 @@ Common patterns: `YYYY/MM/DD` (default), `YYYY-MM-DD` (ISO 8601), `MM/DD/YYYY` (
|
|
|
256
256
|
|
|
257
257
|
## Additional Features
|
|
258
258
|
|
|
259
|
+
### Presets
|
|
260
|
+
|
|
261
|
+
Use the `presets` prop to display a list of quick-select options alongside the calendar. This is useful when users frequently select common dates like "Today" or a specific day offset. The preset panel appears to the right of the calendar inside the popup.
|
|
262
|
+
|
|
263
|
+
Each preset's `value` must match the component's `format` prop. When the current value matches a preset, that preset is automatically highlighted -- regardless of whether the value was set via the preset button or by selecting the same date on the calendar.
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
<DatePicker {...args} value={value} onChange={e => {
|
|
267
|
+
setValue(e.target.value);
|
|
268
|
+
args.onChange?.(e);
|
|
269
|
+
}} presets={[{
|
|
270
|
+
label: 'Today',
|
|
271
|
+
value: fmt(today)
|
|
272
|
+
}, {
|
|
273
|
+
label: 'Yesterday',
|
|
274
|
+
value: daysAgo(1)
|
|
275
|
+
}, {
|
|
276
|
+
label: '3 days ago',
|
|
277
|
+
value: daysAgo(3)
|
|
278
|
+
}, {
|
|
279
|
+
label: '1 week ago',
|
|
280
|
+
value: daysAgo(7)
|
|
281
|
+
}]} />
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
```tsx
|
|
285
|
+
import { DatePicker } from '@ceed/cds';
|
|
286
|
+
|
|
287
|
+
function QuickDateSelect() {
|
|
288
|
+
const [date, setDate] = useState('');
|
|
289
|
+
const today = new Date();
|
|
290
|
+
const fmt = (d: Date) =>
|
|
291
|
+
`${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
<DatePicker
|
|
295
|
+
label="Select Date"
|
|
296
|
+
value={date}
|
|
297
|
+
onChange={(e) => setDate(e.target.value)}
|
|
298
|
+
presets={[
|
|
299
|
+
{ label: 'Today', value: fmt(today) },
|
|
300
|
+
{ label: 'Yesterday', value: fmt(new Date(today.getTime() - 86400000)) },
|
|
301
|
+
]}
|
|
302
|
+
/>
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
```
|
|
306
|
+
|
|
259
307
|
### Reset Button
|
|
260
308
|
|
|
261
309
|
Pair DatePicker with an external reset button to programmatically clear the value.
|
|
@@ -432,6 +480,42 @@ function RegionalDateField({ locale }: { locale: string }) {
|
|
|
432
480
|
<DatePicker value={invalidDate} />
|
|
433
481
|
```
|
|
434
482
|
|
|
483
|
+
## Props and Customization
|
|
484
|
+
|
|
485
|
+
### Key Props
|
|
486
|
+
|
|
487
|
+
| Prop | Type | Default | Description |
|
|
488
|
+
| ------------------- | ------------------------------------------------------- | -------------- | ---------------------------------------------------------------------------------------------- |
|
|
489
|
+
| `value` | `string` | - | Selected date string in `format` (controlled mode) |
|
|
490
|
+
| `defaultValue` | `string` | `''` | Initial date string (uncontrolled mode) |
|
|
491
|
+
| `onChange` | `(event: { target: { name?, value: string } }) => void` | - | Callback when the date changes. Value is in `format` |
|
|
492
|
+
| `format` | `string` | `'YYYY/MM/DD'` | Format of the `value` and `onChange` value. Determines the internal data format |
|
|
493
|
+
| `displayFormat` | `string` | `'YYYY/MM/DD'` | Format displayed in the input field. Can differ from `format` for locale display |
|
|
494
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
495
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
496
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
497
|
+
| `required` | `boolean` | `false` | Marks the field as required (adds asterisk to label) |
|
|
498
|
+
| `disabled` | `boolean` | `false` | Disables the entire component |
|
|
499
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
500
|
+
| `minDate` | `string` | - | Minimum selectable date (in `format`) |
|
|
501
|
+
| `maxDate` | `string` | - | Maximum selectable date (in `format`) |
|
|
502
|
+
| `disableFuture` | `boolean` | `false` | Disables all future dates |
|
|
503
|
+
| `disablePast` | `boolean` | `false` | Disables all past dates |
|
|
504
|
+
| `shouldDisableDate` | `(date: string) => boolean` | - | Custom function to disable specific dates. Receives date in `format`. Return `true` to disable |
|
|
505
|
+
| `inputReadOnly` | `boolean` | `false` | Prevents keyboard typing in the input (users must use the calendar popup) |
|
|
506
|
+
| `hideClearButton` | `boolean` | `false` | Hides the clear button in the calendar popup |
|
|
507
|
+
|
|
508
|
+
### format vs displayFormat
|
|
509
|
+
|
|
510
|
+
| Prop | Controls | Example |
|
|
511
|
+
| --------------- | ------------------------------------------------------ | ------------------------------------------------- |
|
|
512
|
+
| `format` | Value in `onChange`, `value`, and `defaultValue` props | `'YYYY-MM-DD'` → onChange receives `'2024-05-03'` |
|
|
513
|
+
| `displayFormat` | What the user sees in the input field | `'MM/DD/YYYY'` → input shows `05/03/2024` |
|
|
514
|
+
|
|
515
|
+
When both are set, the component converts between formats internally. This lets you keep a consistent API format while showing locale-appropriate display.
|
|
516
|
+
|
|
517
|
+
> **Note**: DatePicker also accepts all Input props (e.g., `size`, `variant`, `color`, `startDecorator`, `placeholder`, `sx`).
|
|
518
|
+
|
|
435
519
|
## Accessibility
|
|
436
520
|
|
|
437
521
|
- **Keyboard navigation**: Tab moves focus between the input and the calendar toggle button. Arrow keys navigate dates within the open calendar. Enter selects the focused date, and Escape closes the calendar popup.
|
|
@@ -339,6 +339,68 @@ Fully read-only state where neither typing nor calendar selection is available.
|
|
|
339
339
|
|
|
340
340
|
## Additional Options
|
|
341
341
|
|
|
342
|
+
### Presets
|
|
343
|
+
|
|
344
|
+
Use the `presets` prop to display quick-select options alongside the calendar, such as "Last 7 days" or "Last 1 month". The preset panel appears to the right of the calendar inside the popup, providing one-click access to commonly used date ranges.
|
|
345
|
+
|
|
346
|
+
Each preset's `value` must match the component's `format` prop and use the `-` separator (e.g., `"2026/03/01 - 2026/04/03"`). When the current value matches a preset, that preset is automatically highlighted -- regardless of whether the value was set via the preset button or by selecting the same range on the calendar.
|
|
347
|
+
|
|
348
|
+
```tsx
|
|
349
|
+
<DateRangePicker {...args} value={value} onChange={e => {
|
|
350
|
+
setValue(e.target.value);
|
|
351
|
+
args.onChange?.(e);
|
|
352
|
+
}} presets={[{
|
|
353
|
+
label: 'Today',
|
|
354
|
+
value: `${fmt(today)} - ${fmt(today)}`
|
|
355
|
+
}, {
|
|
356
|
+
label: 'Last 3 days',
|
|
357
|
+
value: range(3)
|
|
358
|
+
}, {
|
|
359
|
+
label: 'Last 7 days',
|
|
360
|
+
value: range(7)
|
|
361
|
+
}, {
|
|
362
|
+
label: 'Last 1 month',
|
|
363
|
+
value: range(1, 'months')
|
|
364
|
+
}, {
|
|
365
|
+
label: 'Last 3 months',
|
|
366
|
+
value: range(3, 'months')
|
|
367
|
+
}, {
|
|
368
|
+
label: 'Last 6 months',
|
|
369
|
+
value: range(6, 'months')
|
|
370
|
+
}]} />
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
import { DateRangePicker } from '@ceed/cds';
|
|
375
|
+
|
|
376
|
+
function ReportFilter() {
|
|
377
|
+
const [dateRange, setDateRange] = useState('');
|
|
378
|
+
const today = new Date();
|
|
379
|
+
const fmt = (d: Date) =>
|
|
380
|
+
`${d.getFullYear()}/${String(d.getMonth() + 1).padStart(2, '0')}/${String(d.getDate()).padStart(2, '0')}`;
|
|
381
|
+
const monthsAgo = (n: number) => {
|
|
382
|
+
const d = new Date(today);
|
|
383
|
+
d.setMonth(d.getMonth() - n);
|
|
384
|
+
return `${fmt(d)} - ${fmt(today)}`;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
return (
|
|
388
|
+
<DateRangePicker
|
|
389
|
+
label="Report Period"
|
|
390
|
+
value={dateRange}
|
|
391
|
+
onChange={(e) => setDateRange(e.target.value)}
|
|
392
|
+
disableFuture
|
|
393
|
+
presets={[
|
|
394
|
+
{ label: 'Last 7 days', value: `${fmt(new Date(today.getTime() - 7 * 86400000))} - ${fmt(today)}` },
|
|
395
|
+
{ label: 'Last 1 month', value: monthsAgo(1) },
|
|
396
|
+
{ label: 'Last 3 months', value: monthsAgo(3) },
|
|
397
|
+
{ label: 'Last 6 months', value: monthsAgo(6) },
|
|
398
|
+
]}
|
|
399
|
+
/>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
```
|
|
403
|
+
|
|
342
404
|
### Hide Clear Button
|
|
343
405
|
|
|
344
406
|
Remove the clear button from the calendar popup using `hideClearButton`.
|
|
@@ -500,6 +562,32 @@ const getDuration = (value) => {
|
|
|
500
562
|
<DateRangePicker helperText={getDuration(dateRange)} />
|
|
501
563
|
```
|
|
502
564
|
|
|
565
|
+
## Props and Customization
|
|
566
|
+
|
|
567
|
+
### Key Props
|
|
568
|
+
|
|
569
|
+
| Prop | Type | Default | Description |
|
|
570
|
+
| ----------------- | ------------------------------------------------------- | -------------- | -------------------------------------------------------- |
|
|
571
|
+
| `value` | `string` | - | Selected date range string in `format` (controlled mode) |
|
|
572
|
+
| `defaultValue` | `string` | `''` | Initial date range string (uncontrolled mode) |
|
|
573
|
+
| `onChange` | `(event: { target: { name?, value: string } }) => void` | - | Callback when the date range changes |
|
|
574
|
+
| `format` | `string` | `'YYYY/MM/DD'` | Format of the `value` and `onChange` value |
|
|
575
|
+
| `displayFormat` | `string` | `'YYYY/MM/DD'` | Format displayed in the input field |
|
|
576
|
+
| `label` | `ReactNode` | - | Form label displayed above the input |
|
|
577
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the input |
|
|
578
|
+
| `error` | `boolean` | `false` | Applies danger color to indicate validation error |
|
|
579
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
580
|
+
| `disabled` | `boolean` | `false` | Disables the entire component |
|
|
581
|
+
| `name` | `string` | - | HTML name attribute for form submission |
|
|
582
|
+
| `minDate` | `string` | - | Minimum selectable date (in `format`) |
|
|
583
|
+
| `maxDate` | `string` | - | Maximum selectable date (in `format`) |
|
|
584
|
+
| `disableFuture` | `boolean` | `false` | Disables all future dates |
|
|
585
|
+
| `disablePast` | `boolean` | `false` | Disables all past dates |
|
|
586
|
+
| `inputReadOnly` | `boolean` | `false` | Prevents keyboard typing (calendar-only input) |
|
|
587
|
+
| `hideClearButton` | `boolean` | `false` | Hides the clear button in the calendar popup |
|
|
588
|
+
|
|
589
|
+
> **Note**: DateRangePicker also accepts all Input props (e.g., `size`, `variant`, `color`, `sx`).
|
|
590
|
+
|
|
503
591
|
## Accessibility
|
|
504
592
|
|
|
505
593
|
- The input has `role="textbox"` and the calendar button has `aria-label="Toggle Calendar"` for screen reader identification.
|
|
@@ -6,10 +6,10 @@ FilterableCheckboxGroup is a multi-select component that combines a search input
|
|
|
6
6
|
|
|
7
7
|
Key capabilities include a "Select all" toggle for bulk selection, automatic sorting (selected items first, then alphabetical), customizable list height, and built-in form integration via `label`, `helperText`, and `required` props. The component accepts options as either simple strings or `{ value, label }` objects.
|
|
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
|
<FilterableCheckboxGroup
|
|
@@ -310,6 +310,23 @@ When dealing with a large set of options like countries, the search filter and v
|
|
|
310
310
|
|
|
311
311
|
5. **Keep option labels concise.** Long labels will be truncated with an ellipsis. If detailed descriptions are needed, consider using a tooltip or a separate detail view.
|
|
312
312
|
|
|
313
|
+
## Props and Customization
|
|
314
|
+
|
|
315
|
+
### Key Props
|
|
316
|
+
|
|
317
|
+
| Prop | Type | Default | Description |
|
|
318
|
+
| ------------- | -------------------------------------------------------- | ---------- | --------------------------------------------------- |
|
|
319
|
+
| `options` | `{ value: string; label: string; disabled?: boolean }[]` | (required) | Array of checkbox options |
|
|
320
|
+
| `value` | `string[]` | - | Selected values (controlled mode) |
|
|
321
|
+
| `onChange` | `(value: string[]) => void` | - | Callback when selection changes |
|
|
322
|
+
| `label` | `ReactNode` | - | Group label displayed above the component |
|
|
323
|
+
| `helperText` | `ReactNode` | - | Helper text displayed below the component |
|
|
324
|
+
| `placeholder` | `string` | - | Placeholder text for the search input |
|
|
325
|
+
| `required` | `boolean` | `false` | Marks the field as required |
|
|
326
|
+
| `disabled` | `boolean` | `false` | Disables all checkboxes |
|
|
327
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Component size |
|
|
328
|
+
| `maxHeight` | `string \| number` | `300` | Maximum height of the options list before scrolling |
|
|
329
|
+
|
|
313
330
|
## Accessibility
|
|
314
331
|
|
|
315
332
|
- The search input is labeled by the component's `label` prop, ensuring screen readers announce its purpose.
|
|
@@ -294,8 +294,8 @@ function SettingsForm() {
|
|
|
294
294
|
|
|
295
295
|
> **Tip: Use built-in form props instead**
|
|
296
296
|
>
|
|
297
|
-
> Input, Select, Textarea, DatePicker
|
|
298
|
-
>
|
|
297
|
+
> Input-family components such as Input, Select, Textarea, and DatePicker support `label` and `helperText` props directly.
|
|
298
|
+
> For simple form fields, using each component's built-in props is more concise.
|
|
299
299
|
>
|
|
300
300
|
> ```tsx
|
|
301
301
|
> // ✅ Simpler: built-in props
|
|
@@ -352,6 +352,36 @@ function SettingsForm() {
|
|
|
352
352
|
|
|
353
353
|
5. **Provide helpful error messages**: When using the error state, always include a FormHelperText explaining what went wrong and how to fix it.
|
|
354
354
|
|
|
355
|
+
## Props and Customization
|
|
356
|
+
|
|
357
|
+
### FormControl Props
|
|
358
|
+
|
|
359
|
+
| Prop | Type | Default | Description |
|
|
360
|
+
| ------------- | -------------------------------------------------------------- | ------------ | ----------------------------------------------------------------- |
|
|
361
|
+
| `children` | `ReactNode` | - | Form field elements (FormLabel, Input, FormHelperText, etc.) |
|
|
362
|
+
| `error` | `boolean` | `false` | Applies error styling to child components |
|
|
363
|
+
| `disabled` | `boolean` | `false` | Disables all child form elements |
|
|
364
|
+
| `required` | `boolean` | `false` | Adds required indicator to FormLabel and `aria-required` to input |
|
|
365
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size applied to child components |
|
|
366
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
367
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'vertical'` | Layout direction |
|
|
368
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
369
|
+
|
|
370
|
+
### FormLabel Props
|
|
371
|
+
|
|
372
|
+
| Prop | Type | Default | Description |
|
|
373
|
+
| ---------- | ----------- | ------- | ------------------------------------------------------- |
|
|
374
|
+
| `children` | `ReactNode` | - | Label text |
|
|
375
|
+
| `required` | `boolean` | - | Shows asterisk (inherited from FormControl when nested) |
|
|
376
|
+
|
|
377
|
+
### FormHelperText Props
|
|
378
|
+
|
|
379
|
+
| Prop | Type | Default | Description |
|
|
380
|
+
| ---------- | ----------- | ------- | ---------------------------- |
|
|
381
|
+
| `children` | `ReactNode` | - | Helper or error message text |
|
|
382
|
+
|
|
383
|
+
> **Note**: FormControl, FormLabel, and FormHelperText accept all their respective Joy UI props.
|
|
384
|
+
|
|
355
385
|
## Accessibility
|
|
356
386
|
|
|
357
387
|
- FormControl automatically associates FormLabel with the input using `htmlFor` and `id`.
|
|
@@ -402,6 +402,24 @@ import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
|
|
402
402
|
|
|
403
403
|
5. **Maintain consistent sizing within the same context.** Use the same `size` and `variant` for all IconButtons in a toolbar or action group to keep the interface clean and predictable.
|
|
404
404
|
|
|
405
|
+
## Props and Customization
|
|
406
|
+
|
|
407
|
+
### Key Props
|
|
408
|
+
|
|
409
|
+
| Prop | Type | Default | Description |
|
|
410
|
+
| ----------- | -------------------------------------------------------------- | ----------- | ---------------------------------------- |
|
|
411
|
+
| `children` | `ReactNode` | - | Icon element to render inside the button |
|
|
412
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'plain'` | Visual style |
|
|
413
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
414
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme |
|
|
415
|
+
| `disabled` | `boolean` | `false` | Disables the button |
|
|
416
|
+
| `loading` | `boolean` | `false` | Shows a loading indicator |
|
|
417
|
+
| `component` | `ElementType` | `'button'` | Root element type (polymorphic) |
|
|
418
|
+
| `onClick` | `(event: MouseEvent) => void` | - | Click event handler |
|
|
419
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system |
|
|
420
|
+
|
|
421
|
+
> **Note**: IconButton also accepts all Joy UI IconButton props and Framer Motion props.
|
|
422
|
+
|
|
405
423
|
## Accessibility
|
|
406
424
|
|
|
407
425
|
- **`aria-label` is essential**: Every IconButton must have either an `aria-label`, `aria-labelledby`, or a wrapping Tooltip with `title` to provide a text alternative for screen readers.
|