@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
Grid
|
|
5
|
+
The Grid component is a powerful layout system built on CSS Grid. It uses a 12-column grid system, making it easy to create responsive layouts and apply different layouts at different breakpoints. It is well suited for complex dashboards, product catalogs, card layouts, and more.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Grid container spacing={args.spacing}>
|
|
@@ -57,7 +57,7 @@ function MyComponent() {
|
|
|
57
57
|
|
|
58
58
|
### Basic Usage
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
The basic usage of the 12-column grid system.
|
|
61
61
|
|
|
62
62
|
```tsx
|
|
63
63
|
<div style={{
|
|
@@ -89,7 +89,7 @@ function MyComponent() {
|
|
|
89
89
|
|
|
90
90
|
### Responsive Grid
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
A responsive grid that applies different layouts across different screen sizes.
|
|
93
93
|
|
|
94
94
|
```tsx
|
|
95
95
|
<div>
|
|
@@ -137,7 +137,7 @@ function MyComponent() {
|
|
|
137
137
|
|
|
138
138
|
### Different Spacing
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
Grid layouts with different spacing values.
|
|
141
141
|
|
|
142
142
|
```tsx
|
|
143
143
|
<div style={{
|
|
@@ -201,7 +201,7 @@ function MyComponent() {
|
|
|
201
201
|
|
|
202
202
|
### Nested Grid
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
You can nest one grid inside another.
|
|
205
205
|
|
|
206
206
|
```tsx
|
|
207
207
|
<div>
|
|
@@ -265,7 +265,7 @@ function MyComponent() {
|
|
|
265
265
|
|
|
266
266
|
### Auto Layout
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
A grid using auto layout.
|
|
269
269
|
|
|
270
270
|
```tsx
|
|
271
271
|
<div style={{
|
|
@@ -309,7 +309,7 @@ function MyComponent() {
|
|
|
309
309
|
|
|
310
310
|
### Complex Layouts
|
|
311
311
|
|
|
312
|
-
|
|
312
|
+
Complex layout examples based on real use cases.
|
|
313
313
|
|
|
314
314
|
```tsx
|
|
315
315
|
<div style={{
|
|
@@ -435,7 +435,7 @@ function MyComponent() {
|
|
|
435
435
|
|
|
436
436
|
### Breakpoint Demo
|
|
437
437
|
|
|
438
|
-
|
|
438
|
+
An example showing how Grid behaves at each breakpoint.
|
|
439
439
|
|
|
440
440
|
```tsx
|
|
441
441
|
<div>
|
|
@@ -491,61 +491,49 @@ function MyComponent() {
|
|
|
491
491
|
|
|
492
492
|
## Grid System
|
|
493
493
|
|
|
494
|
-
### 12
|
|
494
|
+
### 12-Column System
|
|
495
495
|
|
|
496
|
-
Grid
|
|
496
|
+
Grid is based on a 12-column system. Each item can span 1 to 12 columns.
|
|
497
497
|
|
|
498
498
|
```tsx
|
|
499
499
|
<Grid container spacing={2}>
|
|
500
|
-
<Grid item xs={12}>
|
|
501
|
-
|
|
502
|
-
</Grid>
|
|
503
|
-
<Grid item xs={
|
|
504
|
-
|
|
505
|
-
</Grid>
|
|
506
|
-
<Grid item xs={6}>
|
|
507
|
-
절반 너비 (6/12)
|
|
508
|
-
</Grid>
|
|
509
|
-
<Grid item xs={4}>
|
|
510
|
-
3분의 1 너비 (4/12)
|
|
511
|
-
</Grid>
|
|
512
|
-
<Grid item xs={4}>
|
|
513
|
-
3분의 1 너비 (4/12)
|
|
514
|
-
</Grid>
|
|
515
|
-
<Grid item xs={4}>
|
|
516
|
-
3분의 1 너비 (4/12)
|
|
517
|
-
</Grid>
|
|
500
|
+
<Grid item xs={12}>전체 너비 (12/12)</Grid>
|
|
501
|
+
<Grid item xs={6}>절반 너비 (6/12)</Grid>
|
|
502
|
+
<Grid item xs={6}>절반 너비 (6/12)</Grid>
|
|
503
|
+
<Grid item xs={4}>3분의 1 너비 (4/12)</Grid>
|
|
504
|
+
<Grid item xs={4}>3분의 1 너비 (4/12)</Grid>
|
|
505
|
+
<Grid item xs={4}>3분의 1 너비 (4/12)</Grid>
|
|
518
506
|
</Grid>
|
|
519
507
|
```
|
|
520
508
|
|
|
521
509
|
### Container & Item
|
|
522
510
|
|
|
523
|
-
- `container`:
|
|
524
|
-
- `item`:
|
|
525
|
-
-
|
|
511
|
+
- `container`: Used to create a Grid container
|
|
512
|
+
- `item`: Used to create a Grid item
|
|
513
|
+
- A single component can be both a `container` and an `item` at the same time (nested grid)
|
|
526
514
|
|
|
527
515
|
## Breakpoints
|
|
528
516
|
|
|
529
|
-
Grid
|
|
517
|
+
Grid supports the following breakpoints:
|
|
530
518
|
|
|
531
|
-
|
|
|
532
|
-
|
|
|
533
|
-
| `xs`
|
|
534
|
-
| `sm`
|
|
535
|
-
| `md`
|
|
536
|
-
| `lg`
|
|
537
|
-
| `xl`
|
|
519
|
+
| Breakpoint | Size | Description |
|
|
520
|
+
| ---------- | ------- | --------------------------------- |
|
|
521
|
+
| `xs` | 0px+ | Mobile (portrait) |
|
|
522
|
+
| `sm` | 600px+ | Mobile (landscape) / small tablet |
|
|
523
|
+
| `md` | 900px+ | Tablet |
|
|
524
|
+
| `lg` | 1200px+ | Desktop |
|
|
525
|
+
| `xl` | 1536px+ | Large desktop |
|
|
538
526
|
|
|
539
|
-
###
|
|
527
|
+
### Responsive Usage
|
|
540
528
|
|
|
541
529
|
```tsx
|
|
542
530
|
<Grid container spacing={2}>
|
|
543
531
|
<Grid item xs={12} sm={6} md={4} lg={3}>
|
|
544
532
|
{/*
|
|
545
|
-
xs: 100% (12/12) -
|
|
546
|
-
sm: 50% (6/12) -
|
|
547
|
-
md: 33% (4/12) -
|
|
548
|
-
lg: 25% (3/12) -
|
|
533
|
+
xs: 100% (12/12) - full width on mobile
|
|
534
|
+
sm: 50% (6/12) - half width on small screens
|
|
535
|
+
md: 33% (4/12) - one-third width on tablets
|
|
536
|
+
lg: 25% (3/12) - one-quarter width on desktop
|
|
549
537
|
*/}
|
|
550
538
|
반응형 아이템
|
|
551
539
|
</Grid>
|
|
@@ -554,21 +542,21 @@ Grid는 다음 브레이크포인트를 지원합니다:
|
|
|
554
542
|
|
|
555
543
|
## Spacing
|
|
556
544
|
|
|
557
|
-
|
|
545
|
+
You can control the spacing between grid items using the `spacing` prop.
|
|
558
546
|
|
|
559
|
-
|
|
|
560
|
-
|
|
|
561
|
-
| `0`
|
|
562
|
-
| `1`
|
|
563
|
-
| `2`
|
|
564
|
-
| `3`
|
|
565
|
-
| `4`
|
|
566
|
-
| `5`
|
|
567
|
-
| `6`
|
|
547
|
+
| Value | Size | Description |
|
|
548
|
+
| ----- | ---- | ----------------------- |
|
|
549
|
+
| `0` | 0px | No spacing |
|
|
550
|
+
| `1` | 8px | Very small spacing |
|
|
551
|
+
| `2` | 16px | Small spacing (default) |
|
|
552
|
+
| `3` | 24px | Medium spacing |
|
|
553
|
+
| `4` | 32px | Large spacing |
|
|
554
|
+
| `5` | 40px | Very large spacing |
|
|
555
|
+
| `6` | 48px | Maximum spacing |
|
|
568
556
|
|
|
569
557
|
## Auto Layout
|
|
570
558
|
|
|
571
|
-
|
|
559
|
+
You can let items size and position automatically without explicitly defining the column count:
|
|
572
560
|
|
|
573
561
|
```tsx
|
|
574
562
|
<Grid container spacing={2}>
|
|
@@ -664,9 +652,7 @@ Grid는 다음 브레이크포인트를 지원합니다:
|
|
|
664
652
|
</Grid>
|
|
665
653
|
|
|
666
654
|
<Grid item xs={12}>
|
|
667
|
-
<Button type="submit" fullWidth>
|
|
668
|
-
Submit
|
|
669
|
-
</Button>
|
|
655
|
+
<Button type="submit" fullWidth>Submit</Button>
|
|
670
656
|
</Grid>
|
|
671
657
|
</Grid>
|
|
672
658
|
```
|
|
@@ -680,7 +666,7 @@ Grid는 다음 브레이크포인트를 지원합니다:
|
|
|
680
666
|
<Box
|
|
681
667
|
sx={{
|
|
682
668
|
position: 'relative',
|
|
683
|
-
paddingTop: '100%', // 1:1
|
|
669
|
+
paddingTop: '100%', // maintain a 1:1 ratio
|
|
684
670
|
overflow: 'hidden',
|
|
685
671
|
borderRadius: 'sm',
|
|
686
672
|
}}
|
|
@@ -705,38 +691,58 @@ Grid는 다음 브레이크포인트를 지원합니다:
|
|
|
705
691
|
|
|
706
692
|
## Best Practices
|
|
707
693
|
|
|
708
|
-
1.
|
|
694
|
+
1. **Use meaningful structure**: Choose appropriate elements while considering semantic HTML structure when using Grid.
|
|
695
|
+
|
|
696
|
+
2. **Design responsively first**: Start with mobile layouts and scale up to larger screens.
|
|
697
|
+
|
|
698
|
+
3. **Keep spacing consistent**: Use consistent spacing values across the project.
|
|
699
|
+
|
|
700
|
+
4. **Optimize performance**:
|
|
701
|
+
- Avoid unnecessarily deep nesting
|
|
702
|
+
- Consider virtualization when rendering many items
|
|
703
|
+
|
|
704
|
+
5. **Consider accessibility**:
|
|
705
|
+
- Use appropriate semantic tags
|
|
706
|
+
- Arrange content so keyboard navigation remains logical
|
|
709
707
|
|
|
710
|
-
|
|
708
|
+
6. **Prioritize content**: Let the grid adapt to the content instead of forcing content into the grid.
|
|
711
709
|
|
|
712
|
-
|
|
710
|
+
7. **Debug effectively**: Apply background colors to Grid items during development to inspect the layout more easily.
|
|
713
711
|
|
|
714
|
-
|
|
715
|
-
- 불필요하게 깊은 중첩은 피하세요
|
|
716
|
-
- 많은 아이템이 있을 때는 가상화를 고려하세요
|
|
712
|
+
## Props and Customization
|
|
717
713
|
|
|
718
|
-
|
|
719
|
-
- 적절한 시맨틱 태그를 사용하세요
|
|
720
|
-
- 키보드 탐색이 논리적으로 이뤄지도록 배치하세요
|
|
714
|
+
### Key Props
|
|
721
715
|
|
|
722
|
-
|
|
716
|
+
| Prop | Type | Default | Description |
|
|
717
|
+
| ----------- | -------------------------------------------------------- | ------- | ------------------------------------ |
|
|
718
|
+
| `children` | `ReactNode` | - | Grid children (items) |
|
|
719
|
+
| `container` | `boolean` | `false` | Sets the element as a grid container |
|
|
720
|
+
| `xs` | `number \| 'auto' \| boolean` | - | Column span at xs breakpoint |
|
|
721
|
+
| `sm` | `number \| 'auto' \| boolean` | - | Column span at sm breakpoint |
|
|
722
|
+
| `md` | `number \| 'auto' \| boolean` | - | Column span at md breakpoint |
|
|
723
|
+
| `lg` | `number \| 'auto' \| boolean` | - | Column span at lg breakpoint |
|
|
724
|
+
| `xl` | `number \| 'auto' \| boolean` | - | Column span at xl breakpoint |
|
|
725
|
+
| `spacing` | `number \| string` | `0` | Gap between grid items |
|
|
726
|
+
| `direction` | `'row' \| 'row-reverse' \| 'column' \| 'column-reverse'` | `'row'` | Flex direction |
|
|
727
|
+
| `columns` | `number` | `12` | Total number of columns |
|
|
728
|
+
| `sx` | `SxProps` | - | Custom styles |
|
|
723
729
|
|
|
724
|
-
|
|
730
|
+
> **Note**: Grid accepts all Joy UI Grid (MUI) props.
|
|
725
731
|
|
|
726
732
|
## Troubleshooting
|
|
727
733
|
|
|
728
|
-
###
|
|
734
|
+
### Common Issues
|
|
729
735
|
|
|
730
|
-
1.
|
|
731
|
-
-
|
|
732
|
-
- container
|
|
736
|
+
1. **Items are positioned differently than expected**
|
|
737
|
+
- Check that the total column count does not exceed 12
|
|
738
|
+
- Make sure the `container` and `item` props are set correctly
|
|
733
739
|
|
|
734
|
-
2.
|
|
735
|
-
-
|
|
736
|
-
-
|
|
740
|
+
2. **Spacing is not applied**
|
|
741
|
+
- Verify that the `spacing` prop is set on the container
|
|
742
|
+
- Verify that child elements are wrapped in Grid items
|
|
737
743
|
|
|
738
|
-
3.
|
|
739
|
-
-
|
|
740
|
-
-
|
|
744
|
+
3. **Responsive behavior is not working**
|
|
745
|
+
- Check that the breakpoint values are correct
|
|
746
|
+
- Make sure the intended total at each breakpoint is 12 or less
|
|
741
747
|
|
|
742
|
-
Grid
|
|
748
|
+
Grid is a powerful tool for building complex layouts. Responsive design and consistent spacing help improve the overall user experience.
|
|
@@ -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.
|