@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
Stack
|
|
5
|
+
The Stack component is a layout component that arranges child elements in one dimension, either vertically or horizontally, with consistent spacing. Built on Flexbox, it provides a simple and intuitive API for creating complex layouts with ease. It is useful across many UI patterns, including navigation bars, form layouts, and card internals.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Stack {...args}>
|
|
@@ -39,7 +39,7 @@ function MyComponent() {
|
|
|
39
39
|
|
|
40
40
|
### Basic Usage
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
The basic usage for vertical (`column`) and horizontal (`row`) layouts.
|
|
43
43
|
|
|
44
44
|
```tsx
|
|
45
45
|
<div style={{
|
|
@@ -77,7 +77,7 @@ function MyComponent() {
|
|
|
77
77
|
|
|
78
78
|
### Directions
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
You can use different layout directions.
|
|
81
81
|
|
|
82
82
|
```tsx
|
|
83
83
|
<div style={{
|
|
@@ -146,7 +146,7 @@ function MyComponent() {
|
|
|
146
146
|
|
|
147
147
|
### Different Spacing
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
You can apply different spacing values.
|
|
150
150
|
|
|
151
151
|
```tsx
|
|
152
152
|
<div style={{
|
|
@@ -210,7 +210,7 @@ function MyComponent() {
|
|
|
210
210
|
|
|
211
211
|
### Alignment
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
You can control element alignment in different ways.
|
|
214
214
|
|
|
215
215
|
```tsx
|
|
216
216
|
<div style={{
|
|
@@ -279,7 +279,7 @@ function MyComponent() {
|
|
|
279
279
|
|
|
280
280
|
### Responsive Direction
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
You can change the layout direction based on screen size.
|
|
283
283
|
|
|
284
284
|
```tsx
|
|
285
285
|
<div>
|
|
@@ -337,7 +337,7 @@ function MyComponent() {
|
|
|
337
337
|
|
|
338
338
|
### Nested Stacks
|
|
339
339
|
|
|
340
|
-
Stack
|
|
340
|
+
You can nest Stack components to build more complex layouts.
|
|
341
341
|
|
|
342
342
|
```tsx
|
|
343
343
|
<div>
|
|
@@ -395,7 +395,7 @@ Stack을 중첩하여 더 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
395
395
|
|
|
396
396
|
### Real World Examples
|
|
397
397
|
|
|
398
|
-
|
|
398
|
+
Examples that demonstrate real-world use cases.
|
|
399
399
|
|
|
400
400
|
```tsx
|
|
401
401
|
<div style={{
|
|
@@ -640,7 +640,7 @@ Stack을 중첩하여 더 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
640
640
|
|
|
641
641
|
### direction
|
|
642
642
|
|
|
643
|
-
|
|
643
|
+
Sets the layout direction of the elements.
|
|
644
644
|
|
|
645
645
|
```tsx
|
|
646
646
|
<Stack direction="row">가로 배치</Stack>
|
|
@@ -648,7 +648,7 @@ Stack을 중첩하여 더 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
648
648
|
<Stack direction="row-reverse">가로 역순</Stack>
|
|
649
649
|
<Stack direction="column-reverse">세로 역순</Stack>
|
|
650
650
|
|
|
651
|
-
//
|
|
651
|
+
// responsive direction
|
|
652
652
|
<Stack direction={{ xs: 'column', sm: 'row' }}>
|
|
653
653
|
반응형 배치
|
|
654
654
|
</Stack>
|
|
@@ -656,26 +656,26 @@ Stack을 중첩하여 더 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
656
656
|
|
|
657
657
|
### spacing
|
|
658
658
|
|
|
659
|
-
|
|
659
|
+
Sets the spacing between elements.
|
|
660
660
|
|
|
661
|
-
|
|
|
662
|
-
| ----- | ---- |
|
|
663
|
-
| `0` | 0px |
|
|
664
|
-
| `0.5` | 4px |
|
|
665
|
-
| `1` | 8px |
|
|
666
|
-
| `1.5` | 12px |
|
|
667
|
-
| `2` | 16px |
|
|
668
|
-
| `3` | 24px |
|
|
669
|
-
| `4` | 32px |
|
|
670
|
-
| `5` | 40px |
|
|
671
|
-
| `6` | 48px |
|
|
661
|
+
| Value | Size | Description |
|
|
662
|
+
| ----- | ---- | ------------------------ |
|
|
663
|
+
| `0` | 0px | No spacing |
|
|
664
|
+
| `0.5` | 4px | Very small spacing |
|
|
665
|
+
| `1` | 8px | Small spacing |
|
|
666
|
+
| `1.5` | 12px | Small-to-medium spacing |
|
|
667
|
+
| `2` | 16px | Medium spacing (default) |
|
|
668
|
+
| `3` | 24px | Large spacing |
|
|
669
|
+
| `4` | 32px | Very large spacing |
|
|
670
|
+
| `5` | 40px | Extra large spacing |
|
|
671
|
+
| `6` | 48px | Maximum spacing |
|
|
672
672
|
|
|
673
673
|
```tsx
|
|
674
674
|
<Stack spacing={2}>기본 간격</Stack>
|
|
675
675
|
<Stack spacing={0}>간격 없음</Stack>
|
|
676
676
|
<Stack spacing={4}>큰 간격</Stack>
|
|
677
677
|
|
|
678
|
-
//
|
|
678
|
+
// responsive spacing
|
|
679
679
|
<Stack spacing={{ xs: 1, sm: 2, md: 3 }}>
|
|
680
680
|
반응형 간격
|
|
681
681
|
</Stack>
|
|
@@ -683,7 +683,7 @@ Stack을 중첩하여 더 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
683
683
|
|
|
684
684
|
### alignItems
|
|
685
685
|
|
|
686
|
-
|
|
686
|
+
Sets alignment along the cross axis.
|
|
687
687
|
|
|
688
688
|
```tsx
|
|
689
689
|
<Stack alignItems="center">중앙 정렬</Stack>
|
|
@@ -695,7 +695,7 @@ Stack을 중첩하여 더 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
695
695
|
|
|
696
696
|
### justifyContent
|
|
697
697
|
|
|
698
|
-
|
|
698
|
+
Sets alignment along the main axis.
|
|
699
699
|
|
|
700
700
|
```tsx
|
|
701
701
|
<Stack justifyContent="center">중앙 정렬</Stack>
|
|
@@ -707,7 +707,7 @@ Stack을 중첩하여 더 복잡한 레이아웃을 만들 수 있습니다.
|
|
|
707
707
|
|
|
708
708
|
## Responsive Behavior
|
|
709
709
|
|
|
710
|
-
Stack
|
|
710
|
+
Stack supports responsive values for all props:
|
|
711
711
|
|
|
712
712
|
```tsx
|
|
713
713
|
<Stack
|
|
@@ -715,7 +715,7 @@ Stack은 모든 props에서 반응형 값을 지원합니다:
|
|
|
715
715
|
spacing={{ xs: 1, sm: 2, md: 3 }}
|
|
716
716
|
alignItems={{ xs: 'stretch', md: 'center' }}
|
|
717
717
|
>
|
|
718
|
-
{/*
|
|
718
|
+
{/* different layouts for different screen sizes */}
|
|
719
719
|
</Stack>
|
|
720
720
|
```
|
|
721
721
|
|
|
@@ -724,7 +724,12 @@ Stack은 모든 props에서 반응형 값을 지원합니다:
|
|
|
724
724
|
### Navigation Bar
|
|
725
725
|
|
|
726
726
|
```tsx
|
|
727
|
-
<Stack
|
|
727
|
+
<Stack
|
|
728
|
+
direction="row"
|
|
729
|
+
justifyContent="space-between"
|
|
730
|
+
alignItems="center"
|
|
731
|
+
sx={{ p: 2 }}
|
|
732
|
+
>
|
|
728
733
|
<Typography level="title-lg">Logo</Typography>
|
|
729
734
|
<Stack direction="row" spacing={2}>
|
|
730
735
|
<Button variant="plain">Home</Button>
|
|
@@ -776,21 +781,17 @@ Stack은 모든 props에서 반응형 값을 지원합니다:
|
|
|
776
781
|
<Chip variant="soft">New</Chip>
|
|
777
782
|
</Stack>
|
|
778
783
|
|
|
779
|
-
<Typography level="body-md">
|
|
784
|
+
<Typography level="body-md">
|
|
785
|
+
Product description goes here...
|
|
786
|
+
</Typography>
|
|
780
787
|
|
|
781
788
|
<Stack direction="row" spacing={1}>
|
|
782
|
-
<Chip size="sm" variant="outlined">
|
|
783
|
-
|
|
784
|
-
</Chip>
|
|
785
|
-
<Chip size="sm" variant="outlined">
|
|
786
|
-
Tag 2
|
|
787
|
-
</Chip>
|
|
789
|
+
<Chip size="sm" variant="outlined">Tag 1</Chip>
|
|
790
|
+
<Chip size="sm" variant="outlined">Tag 2</Chip>
|
|
788
791
|
</Stack>
|
|
789
792
|
|
|
790
793
|
<Stack direction="row" justifyContent="space-between" alignItems="center">
|
|
791
|
-
<Typography level="title-lg" color="primary">
|
|
792
|
-
$99.99
|
|
793
|
-
</Typography>
|
|
794
|
+
<Typography level="title-lg" color="primary">$99.99</Typography>
|
|
794
795
|
<Button>Add to Cart</Button>
|
|
795
796
|
</Stack>
|
|
796
797
|
</Stack>
|
|
@@ -812,7 +813,9 @@ Stack은 모든 props에서 반응형 값을 지원합니다:
|
|
|
812
813
|
</Stack>
|
|
813
814
|
</Stack>
|
|
814
815
|
|
|
815
|
-
<Typography level="body-md">
|
|
816
|
+
<Typography level="body-md">
|
|
817
|
+
Passionate about creating great user experiences...
|
|
818
|
+
</Typography>
|
|
816
819
|
|
|
817
820
|
<Stack direction="row" spacing={1}>
|
|
818
821
|
<Chip variant="soft">React</Chip>
|
|
@@ -821,9 +824,7 @@ Stack은 모든 props에서 반응형 값을 지원합니다:
|
|
|
821
824
|
</Stack>
|
|
822
825
|
|
|
823
826
|
<Stack direction="row" spacing={2}>
|
|
824
|
-
<Button variant="outlined" fullWidth>
|
|
825
|
-
Follow
|
|
826
|
-
</Button>
|
|
827
|
+
<Button variant="outlined" fullWidth>Follow</Button>
|
|
827
828
|
<Button fullWidth>Message</Button>
|
|
828
829
|
</Stack>
|
|
829
830
|
</Stack>
|
|
@@ -884,53 +885,72 @@ Stack은 모든 props에서 반응형 값을 지원합니다:
|
|
|
884
885
|
|
|
885
886
|
## Best Practices
|
|
886
887
|
|
|
887
|
-
1.
|
|
888
|
+
1. **Choose appropriate spacing**: Use spacing values that match the content hierarchy.
|
|
888
889
|
|
|
889
|
-
2.
|
|
890
|
+
2. **Design responsively**: Use responsive props so layouts work well across different screen sizes.
|
|
890
891
|
|
|
891
|
-
3.
|
|
892
|
+
3. **Use meaningful alignment**: Use `alignItems` and `justifyContent` to create intentional alignment.
|
|
892
893
|
|
|
893
|
-
4.
|
|
894
|
+
4. **Minimize nesting**: Avoid excessive nesting and only nest Stack when it is actually needed.
|
|
894
895
|
|
|
895
|
-
5.
|
|
896
|
+
5. **Consider performance**: Use virtualization when rendering many items.
|
|
896
897
|
|
|
897
|
-
6.
|
|
898
|
-
-
|
|
899
|
-
-
|
|
898
|
+
6. **Consider accessibility**:
|
|
899
|
+
- Arrange elements to preserve a logical tab order
|
|
900
|
+
- Use appropriate semantic tags alongside Stack
|
|
900
901
|
|
|
901
|
-
7.
|
|
902
|
+
7. **Maintain consistency**: Use consistent spacing values across the project.
|
|
902
903
|
|
|
903
904
|
## When to Use Stack vs Other Layout Components
|
|
904
905
|
|
|
905
906
|
### Stack vs Flexbox (Box)
|
|
906
907
|
|
|
907
|
-
- **Stack**:
|
|
908
|
-
- **Box with flex**:
|
|
908
|
+
- **Stack**: For simple one-dimensional layouts with consistent spacing
|
|
909
|
+
- **Box with flex**: For cases that need more complex Flexbox behavior
|
|
909
910
|
|
|
910
911
|
### Stack vs Grid
|
|
911
912
|
|
|
912
|
-
- **Stack**:
|
|
913
|
-
- **Grid**:
|
|
913
|
+
- **Stack**: One-dimensional layouts (vertical or horizontal)
|
|
914
|
+
- **Grid**: Two-dimensional layouts (rows and columns)
|
|
914
915
|
|
|
915
916
|
### Stack vs Space (if available)
|
|
916
917
|
|
|
917
|
-
- **Stack**:
|
|
918
|
-
- **Space**:
|
|
918
|
+
- **Stack**: Provides both a container and spacing
|
|
919
|
+
- **Space**: Provides spacing only (between children)
|
|
920
|
+
|
|
921
|
+
## Props and Customization
|
|
922
|
+
|
|
923
|
+
### Key Props
|
|
924
|
+
|
|
925
|
+
| Prop | Type | Default | Description |
|
|
926
|
+
| ---------------- | -------------------------------------------------------- | ---------- | ----------------------------------------- |
|
|
927
|
+
| `children` | `ReactNode` | - | Stack children |
|
|
928
|
+
| `direction` | `'row' \| 'row-reverse' \| 'column' \| 'column-reverse'` | `'column'` | Flex direction |
|
|
929
|
+
| `spacing` | `number \| string` | `0` | Gap between children |
|
|
930
|
+
| `alignItems` | `string` | - | CSS align-items |
|
|
931
|
+
| `justifyContent` | `string` | - | CSS justify-content |
|
|
932
|
+
| `flexWrap` | `'nowrap' \| 'wrap' \| 'wrap-reverse'` | `'nowrap'` | Flex wrapping behavior |
|
|
933
|
+
| `divider` | `ReactNode` | - | Element inserted between each child |
|
|
934
|
+
| `component` | `ElementType` | `'div'` | Root element type |
|
|
935
|
+
| `useFlexGap` | `boolean` | `false` | Use CSS gap instead of margin for spacing |
|
|
936
|
+
| `sx` | `SxProps` | - | Custom styles |
|
|
937
|
+
|
|
938
|
+
> **Note**: Stack accepts all Joy UI Stack props.
|
|
919
939
|
|
|
920
940
|
## Troubleshooting
|
|
921
941
|
|
|
922
|
-
###
|
|
942
|
+
### Common Issues
|
|
923
943
|
|
|
924
|
-
1.
|
|
925
|
-
-
|
|
926
|
-
- Fragment
|
|
944
|
+
1. **Spacing is not applied**
|
|
945
|
+
- Make sure the elements are direct children
|
|
946
|
+
- Check whether a Fragment or another wrapper is interfering
|
|
927
947
|
|
|
928
|
-
2.
|
|
929
|
-
-
|
|
930
|
-
- alignItems
|
|
948
|
+
2. **Alignment is different from what you expected**
|
|
949
|
+
- Remember that the main axis and cross axis change based on `direction`
|
|
950
|
+
- Understand the difference between `alignItems` and `justifyContent`
|
|
931
951
|
|
|
932
|
-
3.
|
|
933
|
-
-
|
|
934
|
-
-
|
|
952
|
+
3. **Responsive behavior is not working**
|
|
953
|
+
- Check that object syntax like `{ xs: 'column', md: 'row' }` is correct
|
|
954
|
+
- Verify that the breakpoint values are correct
|
|
935
955
|
|
|
936
|
-
Stack
|
|
956
|
+
Stack is an intuitive and powerful layout tool. Its simple API makes complex layouts easy to build, so it fits a wide range of UI patterns.
|
|
@@ -67,6 +67,14 @@ function MyComponent() {
|
|
|
67
67
|
|
|
68
68
|
## Features
|
|
69
69
|
|
|
70
|
+
### Basic Breadcrumbs
|
|
71
|
+
|
|
72
|
+
A simple breadcrumb trail with a few levels of hierarchy. The last item uses `type: 'text'` to indicate the current page.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
<Canvas of={Breadcrumbs.BasicExample} />
|
|
76
|
+
```
|
|
77
|
+
|
|
70
78
|
### Sizes
|
|
71
79
|
|
|
72
80
|
Breadcrumbs are available in three sizes -- `sm`, `md`, and `lg` -- allowing you to match the surrounding layout density.
|
|
@@ -83,39 +91,16 @@ Breadcrumbs are available in three sizes -- `sm`, `md`, and `lg` -- allowing you
|
|
|
83
91
|
|
|
84
92
|
The separator character between items can be customized via the `separator` prop. Common choices include `/`, `>`, and `-`.
|
|
85
93
|
|
|
86
|
-
```
|
|
87
|
-
<Breadcrumbs
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}, {
|
|
97
|
-
label: 'Category',
|
|
98
|
-
type: 'link',
|
|
99
|
-
linkHref: '/'
|
|
100
|
-
}, {
|
|
101
|
-
label: 'Subcategory',
|
|
102
|
-
type: 'link',
|
|
103
|
-
linkHref: '/'
|
|
104
|
-
}, {
|
|
105
|
-
label: 'Product',
|
|
106
|
-
type: 'link',
|
|
107
|
-
linkHref: '/'
|
|
108
|
-
}, {
|
|
109
|
-
label: 'Product Detail',
|
|
110
|
-
type: 'link',
|
|
111
|
-
linkHref: '/'
|
|
112
|
-
}, {
|
|
113
|
-
label: 'Owner',
|
|
114
|
-
type: 'text'
|
|
115
|
-
}]}
|
|
116
|
-
collapsed
|
|
117
|
-
separator="-"
|
|
118
|
-
/>
|
|
94
|
+
```
|
|
95
|
+
<Canvas of={Breadcrumbs.CustomSeparator} />
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Collapsed Breadcrumbs
|
|
99
|
+
|
|
100
|
+
When paths are deep, the component automatically collapses middle items behind an ellipsis. You can control how many items appear at the start and end using `startCrumbCount` and `endCrumbCount`.
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
<Canvas of={Breadcrumbs.CollapsedVariants} />
|
|
119
104
|
```
|
|
120
105
|
|
|
121
106
|
### Expanded View
|
|
@@ -170,42 +155,55 @@ The component handles the edge case of a single breadcrumb item gracefully.
|
|
|
170
155
|
/>
|
|
171
156
|
```
|
|
172
157
|
|
|
158
|
+
### With Icons
|
|
159
|
+
|
|
160
|
+
Breadcrumb items can include icons alongside their labels.
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
<Canvas of={Breadcrumbs.WithIcons} />
|
|
164
|
+
```
|
|
165
|
+
|
|
173
166
|
## Common Use Cases
|
|
174
167
|
|
|
175
|
-
###
|
|
168
|
+
### Admin Dashboard Navigation
|
|
176
169
|
|
|
177
170
|
```tsx
|
|
178
|
-
function
|
|
171
|
+
function UserDetailPage({ user }) {
|
|
179
172
|
const crumbs = [
|
|
180
|
-
{ label: '
|
|
181
|
-
{ label: '
|
|
182
|
-
{ label:
|
|
183
|
-
{ label: service.name, type: 'text' },
|
|
173
|
+
{ label: 'Dashboard', type: 'link', linkHref: '/admin' },
|
|
174
|
+
{ label: 'Users', type: 'link', linkHref: '/admin/users' },
|
|
175
|
+
{ label: user.name, type: 'text' },
|
|
184
176
|
];
|
|
185
177
|
|
|
186
178
|
return (
|
|
187
179
|
<Box>
|
|
188
180
|
<Breadcrumbs crumbs={crumbs} />
|
|
189
|
-
<
|
|
181
|
+
<UserProfile user={user} />
|
|
190
182
|
</Box>
|
|
191
183
|
);
|
|
192
184
|
}
|
|
193
185
|
```
|
|
194
186
|
|
|
195
|
-
###
|
|
187
|
+
### E-commerce Product Page
|
|
196
188
|
|
|
197
189
|
```tsx
|
|
198
|
-
function
|
|
190
|
+
function ProductPage({ product, category, subcategory }) {
|
|
199
191
|
const crumbs = [
|
|
200
192
|
{ label: 'Home', type: 'link', linkHref: '/' },
|
|
201
|
-
{ label: '
|
|
202
|
-
{ label:
|
|
193
|
+
{ label: 'Shop', type: 'link', linkHref: '/shop' },
|
|
194
|
+
{ label: category.name, type: 'link', linkHref: `/shop/${category.slug}` },
|
|
195
|
+
{
|
|
196
|
+
label: subcategory.name,
|
|
197
|
+
type: 'link',
|
|
198
|
+
linkHref: `/shop/${category.slug}/${subcategory.slug}`,
|
|
199
|
+
},
|
|
200
|
+
{ label: product.name, type: 'text' },
|
|
203
201
|
];
|
|
204
202
|
|
|
205
203
|
return (
|
|
206
204
|
<Box>
|
|
207
|
-
<Breadcrumbs crumbs={crumbs}
|
|
208
|
-
<
|
|
205
|
+
<Breadcrumbs crumbs={crumbs} collapsed={true} startCrumbCount={1} endCrumbCount={2} />
|
|
206
|
+
<ProductDetails product={product} />
|
|
209
207
|
</Box>
|
|
210
208
|
);
|
|
211
209
|
}
|
|
@@ -231,6 +229,19 @@ function DynamicBreadcrumbs() {
|
|
|
231
229
|
}
|
|
232
230
|
```
|
|
233
231
|
|
|
232
|
+
## Props and Customization
|
|
233
|
+
|
|
234
|
+
### Key Props
|
|
235
|
+
|
|
236
|
+
| Prop | Type | Default | Description |
|
|
237
|
+
| ----------------- | ---------------------------------------------------------------- | -------------------------------- | ---------------------------------------------------- |
|
|
238
|
+
| `crumbs` | `{ type: 'text' \| 'link'; label: string; linkHref?: string }[]` | (required) | Breadcrumb items |
|
|
239
|
+
| `collapsed` | `boolean` | `true` | Whether long crumb lists are collapsed with ellipsis |
|
|
240
|
+
| `startCrumbCount` | `number` | `1` | Number of crumbs shown at the start when collapsed |
|
|
241
|
+
| `endCrumbCount` | `number` | `3` | Number of crumbs shown at the end when collapsed |
|
|
242
|
+
| `slots` | `{ link?: ElementType }` | - | Custom component for link crumbs |
|
|
243
|
+
| `slotProps` | `{ link?: { color?: string } }` | `{ link: { color: 'neutral' } }` | Props passed to slot components |
|
|
244
|
+
|
|
234
245
|
## Best Practices
|
|
235
246
|
|
|
236
247
|
- **Always start with a root item.** Begin the trail with "Home" or an equivalent top-level link so users can always navigate back to the starting point.
|
|
@@ -161,6 +161,23 @@ function FormDrawer({ open, onClose, onSubmit }) {
|
|
|
161
161
|
}
|
|
162
162
|
```
|
|
163
163
|
|
|
164
|
+
## Props and Customization
|
|
165
|
+
|
|
166
|
+
### Key Props
|
|
167
|
+
|
|
168
|
+
| Prop | Type | Default | Description | |
|
|
169
|
+
| ---------- | -------------------------------------------------------------- | -------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
|
|
170
|
+
| `children` | `ReactNode` | - | Content rendered inside the drawer panel | |
|
|
171
|
+
| `open` | `boolean` | `false` | Controls whether the drawer is visible | |
|
|
172
|
+
| `onClose` | \`(event: React.SyntheticEvent | Event, reason: string) => void\` | - | Called when the drawer requests to close, such as backdrop click or Escape key |
|
|
173
|
+
| `anchor` | `'left' \| 'right' \| 'top' \| 'bottom'` | `'left'` | Edge of the screen from which the drawer slides in | |
|
|
174
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Preset drawer size used to control width or height depending on the anchor | |
|
|
175
|
+
| `variant` | `'plain' \| 'soft' \| 'outlined' \| 'solid'` | `'plain'` | Visual style inherited from Joy UI Drawer | |
|
|
176
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Color scheme inherited from Joy UI Drawer | |
|
|
177
|
+
| `sx` | `SxProps` | - | Custom styles using the MUI system | |
|
|
178
|
+
|
|
179
|
+
> **Note**: Drawer also accepts Joy UI `DrawerProps` and Framer Motion props because the component is a thin wrapper around Joy UI Drawer with motion support.
|
|
180
|
+
|
|
164
181
|
## Best Practices
|
|
165
182
|
|
|
166
183
|
1. **Choose the right size**: Use `sm` (360px) for simple navigation, `md` (600px) for moderate content, and `lg` (900px) for complex detail views or forms.
|
|
@@ -583,6 +583,19 @@ const [open, setOpen] = useState(false);
|
|
|
583
583
|
</Button>
|
|
584
584
|
```
|
|
585
585
|
|
|
586
|
+
## Props and Customization
|
|
587
|
+
|
|
588
|
+
### Key Props
|
|
589
|
+
|
|
590
|
+
| Prop | Type | Default | Description |
|
|
591
|
+
| -------------- | -------------------------------- | ------- | ------------------------------------ |
|
|
592
|
+
| `children` | `ReactNode` | - | Dropdown content (MenuButton + Menu) |
|
|
593
|
+
| `open` | `boolean` | - | Controlled open state |
|
|
594
|
+
| `defaultOpen` | `boolean` | `false` | Initial open state (uncontrolled) |
|
|
595
|
+
| `onOpenChange` | `(event, open: boolean) => void` | - | Callback when open state changes |
|
|
596
|
+
|
|
597
|
+
> **Note**: Dropdown accepts all Joy UI Dropdown props. It is a state management wrapper — style props go on Menu and MenuButton.
|
|
598
|
+
|
|
586
599
|
## Best Practices
|
|
587
600
|
|
|
588
601
|
- **Use the right abstraction level.** If you only need a simple list of text items, prefer `MenuButton` or `IconMenuButton` standalone components. Use `Dropdown` + `Menu` when you need dividers, custom headers, or mixed content inside the menu.
|
|
@@ -225,6 +225,23 @@ function EditorToolbar({ onAction }) {
|
|
|
225
225
|
}
|
|
226
226
|
```
|
|
227
227
|
|
|
228
|
+
## Props and Customization
|
|
229
|
+
|
|
230
|
+
### Key Props
|
|
231
|
+
|
|
232
|
+
| Prop | Type | Default | Description |
|
|
233
|
+
| ---------------------- | ---------------------------------------------------------------------- | ----------- | -------------------------------------------- |
|
|
234
|
+
| `icon` | `ReactNode` | (required) | Icon element to render in the trigger button |
|
|
235
|
+
| `items` | `{ text: string; component?: ElementType; componentProps?: object }[]` | - | Menu items |
|
|
236
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
237
|
+
| `color` | `'primary' \| 'neutral' \| 'danger' \| 'success' \| 'warning'` | `'neutral'` | Button color |
|
|
238
|
+
| `variant` | `'solid' \| 'soft' \| 'outlined' \| 'plain'` | `'plain'` | Button visual style |
|
|
239
|
+
| `disabled` | `boolean` | `false` | Disables the button |
|
|
240
|
+
| `loading` | `boolean` | `false` | Shows loading indicator |
|
|
241
|
+
| `placement` | `Placement` | `'bottom'` | Menu position |
|
|
242
|
+
| `buttonComponent` | `ElementType` | - | Custom trigger element |
|
|
243
|
+
| `buttonComponentProps` | `object` | - | Props passed to custom trigger |
|
|
244
|
+
|
|
228
245
|
## Best Practices
|
|
229
246
|
|
|
230
247
|
- **Always provide `aria-label`.** Since IconMenuButton has no visible text, screen readers rely entirely on the `aria-label` to announce the button's purpose. Include context when possible.
|