@ceed/cds 1.28.1 → 1.29.0-next.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/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/components/SearchBar/SearchBar.d.ts +21 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/data-display/DataTable.md +1 -1
- package/dist/components/data-display/InfoSign.md +91 -74
- package/dist/components/data-display/Typography.md +94 -411
- package/dist/components/feedback/Dialog.md +62 -76
- package/dist/components/feedback/Modal.md +138 -430
- package/dist/components/feedback/llms.txt +0 -2
- package/dist/components/index.d.ts +2 -1
- package/dist/components/inputs/Autocomplete.md +107 -356
- package/dist/components/inputs/ButtonGroup.md +104 -115
- package/dist/components/inputs/CurrencyInput.md +5 -183
- package/dist/components/inputs/DatePicker.md +431 -108
- package/dist/components/inputs/DateRangePicker.md +492 -131
- package/dist/components/inputs/FilterableCheckboxGroup.md +19 -145
- package/dist/components/inputs/IconButton.md +88 -137
- package/dist/components/inputs/Input.md +73 -204
- package/dist/components/inputs/MonthPicker.md +422 -95
- package/dist/components/inputs/MonthRangePicker.md +466 -89
- package/dist/components/inputs/PercentageInput.md +16 -185
- package/dist/components/inputs/RadioButton.md +35 -163
- package/dist/components/inputs/SearchBar.md +44 -0
- package/dist/components/inputs/Select.md +326 -222
- package/dist/components/inputs/Switch.md +376 -143
- package/dist/components/inputs/Textarea.md +10 -213
- package/dist/components/inputs/Uploader/Uploader.md +66 -145
- package/dist/components/inputs/llms.txt +1 -4
- package/dist/components/navigation/Breadcrumbs.md +308 -57
- package/dist/components/navigation/Drawer.md +0 -180
- package/dist/components/navigation/Dropdown.md +215 -98
- package/dist/components/navigation/IconMenuButton.md +502 -40
- package/dist/components/navigation/InsetDrawer.md +650 -281
- package/dist/components/navigation/Link.md +348 -31
- package/dist/components/navigation/Menu.md +285 -92
- package/dist/components/navigation/MenuButton.md +448 -55
- package/dist/components/navigation/Pagination.md +338 -47
- package/dist/components/navigation/Stepper.md +28 -160
- package/dist/components/navigation/Tabs.md +316 -57
- package/dist/components/surfaces/Accordions.md +804 -49
- package/dist/components/surfaces/Card.md +157 -97
- package/dist/components/surfaces/Divider.md +234 -83
- package/dist/components/surfaces/Sheet.md +328 -153
- package/dist/index.cjs +411 -574
- package/dist/index.d.ts +1 -1
- package/dist/index.js +400 -507
- package/dist/llms.txt +1 -9
- package/framer/index.js +1 -1
- package/package.json +17 -22
- package/dist/chunks/rehype-accent-FZRUD7VI.js +0 -39
- package/dist/components/RadioTileGroup/RadioTileGroup.d.ts +0 -56
- package/dist/components/RadioTileGroup/index.d.ts +0 -3
- package/dist/components/feedback/CircularProgress.md +0 -257
- package/dist/components/feedback/Skeleton.md +0 -280
- package/dist/components/inputs/FormControl.md +0 -361
- package/dist/components/inputs/RadioList.md +0 -241
- package/dist/components/inputs/RadioTileGroup.md +0 -507
- package/dist/components/inputs/Slider.md +0 -334
- package/dist/guides/ThemeProvider.md +0 -89
- package/dist/guides/llms.txt +0 -9
- package/dist/index.browser.js +0 -224
- package/dist/index.browser.js.map +0 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Dropdown
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Introduction
|
|
4
4
|
|
|
5
|
-
Dropdown
|
|
5
|
+
Dropdown 컴포넌트는 메뉴나 옵션 목록을 표시하는 컨테이너 역할을 하는 컴포넌트입니다. Joy UI의 Dropdown을 그대로 사용하며, MenuButton과 Menu 컴포넌트와 함께 사용하여 사용자가 클릭할 때 선택 가능한 옵션들을 보여줍니다. 네비게이션 메뉴, 필터 옵션, 사용자 프로필 메뉴 등 다양한 용도로 활용할 수 있습니다.
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
<Dropdown>
|
|
@@ -24,39 +24,27 @@ Dropdown is part of a **composition pattern** together with Menu, MenuItem, Menu
|
|
|
24
24
|
## Usage
|
|
25
25
|
|
|
26
26
|
```tsx
|
|
27
|
-
import { Dropdown, Menu, MenuItem } from '@ceed/cds';
|
|
28
|
-
import { MenuButton } from '@ceed/cds';
|
|
27
|
+
import { Dropdown, MenuButton, Menu, MenuItem } from '@ceed/cds';
|
|
29
28
|
|
|
30
29
|
function MyComponent() {
|
|
31
30
|
return (
|
|
32
31
|
<Dropdown>
|
|
33
|
-
<MenuButton
|
|
32
|
+
<MenuButton>메뉴 열기</MenuButton>
|
|
34
33
|
<Menu>
|
|
35
|
-
<MenuItem
|
|
36
|
-
<MenuItem
|
|
37
|
-
<MenuItem
|
|
34
|
+
<MenuItem>옵션 1</MenuItem>
|
|
35
|
+
<MenuItem>옵션 2</MenuItem>
|
|
36
|
+
<MenuItem>옵션 3</MenuItem>
|
|
38
37
|
</Menu>
|
|
39
38
|
</Dropdown>
|
|
40
39
|
);
|
|
41
40
|
}
|
|
42
41
|
```
|
|
43
42
|
|
|
44
|
-
##
|
|
45
|
-
|
|
46
|
-
Dropdown, Menu, MenuItem, MenuButton, and IconMenuButton form a **menu component family**. Choose the right level of abstraction for your use case:
|
|
47
|
-
|
|
48
|
-
| Approach | When to use |
|
|
49
|
-
| ------------------------------------ | ------------------------------------------------------- |
|
|
50
|
-
| `MenuButton` (standalone) | Simple text-triggered menus with a list of items |
|
|
51
|
-
| `IconMenuButton` (standalone) | Icon-only triggers in space-constrained areas |
|
|
52
|
-
| `Dropdown` + `MenuButton` + `Menu` | Custom menu content (headers, dividers, mixed elements) |
|
|
53
|
-
| `Dropdown` + custom trigger + `Menu` | Fully custom trigger elements |
|
|
54
|
-
|
|
55
|
-
## Features
|
|
43
|
+
## Examples
|
|
56
44
|
|
|
57
45
|
### Basic Dropdown
|
|
58
46
|
|
|
59
|
-
|
|
47
|
+
가장 기본적인 Dropdown 사용법입니다.
|
|
60
48
|
|
|
61
49
|
```tsx
|
|
62
50
|
<Stack direction="row" spacing={2}>
|
|
@@ -84,7 +72,7 @@ The simplest Dropdown pairs a MenuButton trigger with a Menu of items.
|
|
|
84
72
|
|
|
85
73
|
### Button Variants
|
|
86
74
|
|
|
87
|
-
MenuButton
|
|
75
|
+
MenuButton의 다양한 스타일 변형을 사용할 수 있습니다.
|
|
88
76
|
|
|
89
77
|
```tsx
|
|
90
78
|
<Stack direction="row" spacing={2} flexWrap="wrap">
|
|
@@ -124,7 +112,7 @@ MenuButton supports `plain`, `outlined`, `soft`, and `solid` variants to match y
|
|
|
124
112
|
|
|
125
113
|
### Button Colors
|
|
126
114
|
|
|
127
|
-
|
|
115
|
+
MenuButton에 다양한 색상을 적용할 수 있습니다.
|
|
128
116
|
|
|
129
117
|
```tsx
|
|
130
118
|
<Stack direction="row" spacing={2} flexWrap="wrap">
|
|
@@ -182,7 +170,7 @@ Apply semantic colors to the trigger button for different emphasis levels.
|
|
|
182
170
|
|
|
183
171
|
### Menu Placements
|
|
184
172
|
|
|
185
|
-
|
|
173
|
+
메뉴가 나타나는 위치를 설정할 수 있습니다.
|
|
186
174
|
|
|
187
175
|
```tsx
|
|
188
176
|
<Stack direction="row" spacing={2} sx={{
|
|
@@ -228,7 +216,7 @@ Control where the menu appears relative to the trigger using the `placement` pro
|
|
|
228
216
|
|
|
229
217
|
### With Icons
|
|
230
218
|
|
|
231
|
-
|
|
219
|
+
아이콘이 포함된 메뉴를 만들 수 있습니다.
|
|
232
220
|
|
|
233
221
|
```tsx
|
|
234
222
|
<Dropdown>
|
|
@@ -261,7 +249,7 @@ Add icons to menu items and decorators to the trigger button for richer visual c
|
|
|
261
249
|
|
|
262
250
|
### Actions Menu
|
|
263
251
|
|
|
264
|
-
|
|
252
|
+
편집, 삭제 등의 액션 메뉴로 활용할 수 있습니다.
|
|
265
253
|
|
|
266
254
|
```tsx
|
|
267
255
|
<Dropdown>
|
|
@@ -292,7 +280,7 @@ Build action menus for edit, delete, and other operations. Use `color="danger"`
|
|
|
292
280
|
|
|
293
281
|
### Filter Menu
|
|
294
282
|
|
|
295
|
-
|
|
283
|
+
필터링 기능을 위한 드롭다운 메뉴입니다.
|
|
296
284
|
|
|
297
285
|
```tsx
|
|
298
286
|
<Dropdown>
|
|
@@ -310,7 +298,7 @@ Use Dropdown as an interactive filter selector with state management.
|
|
|
310
298
|
|
|
311
299
|
### Profile Dropdown
|
|
312
300
|
|
|
313
|
-
|
|
301
|
+
사용자 프로필 메뉴로 활용할 수 있습니다.
|
|
314
302
|
|
|
315
303
|
```tsx
|
|
316
304
|
<Dropdown>
|
|
@@ -362,7 +350,7 @@ Combine custom content (user info header) with standard menu items for profile m
|
|
|
362
350
|
|
|
363
351
|
### Nested Menus
|
|
364
352
|
|
|
365
|
-
|
|
353
|
+
여러 개의 드롭다운 메뉴를 나란히 배치할 수 있습니다.
|
|
366
354
|
|
|
367
355
|
```tsx
|
|
368
356
|
<Stack direction="row" spacing={3}>
|
|
@@ -403,7 +391,7 @@ Place multiple Dropdown instances side by side to create menu bar patterns.
|
|
|
403
391
|
|
|
404
392
|
### Controlled Dropdown
|
|
405
393
|
|
|
406
|
-
|
|
394
|
+
프로그래밍 방식으로 메뉴의 열림/닫힘 상태를 제어할 수 있습니다.
|
|
407
395
|
|
|
408
396
|
```tsx
|
|
409
397
|
<Stack spacing={2}>
|
|
@@ -428,7 +416,7 @@ Use the `open` and `onOpenChange` props to programmatically control the menu sta
|
|
|
428
416
|
|
|
429
417
|
### Disabled State
|
|
430
418
|
|
|
431
|
-
|
|
419
|
+
비활성 상태의 드롭다운과 메뉴 아이템을 표시할 수 있습니다.
|
|
432
420
|
|
|
433
421
|
```tsx
|
|
434
422
|
<Stack direction="row" spacing={2}>
|
|
@@ -452,7 +440,7 @@ Disable the entire trigger button or individual menu items.
|
|
|
452
440
|
|
|
453
441
|
### Long Menu
|
|
454
442
|
|
|
455
|
-
|
|
443
|
+
많은 옵션이 있는 메뉴는 스크롤을 적용할 수 있습니다.
|
|
456
444
|
|
|
457
445
|
```tsx
|
|
458
446
|
<Dropdown>
|
|
@@ -472,7 +460,7 @@ Apply `maxHeight` and `overflow: 'auto'` to Menu for scrollable lists with many
|
|
|
472
460
|
|
|
473
461
|
### Custom Styling
|
|
474
462
|
|
|
475
|
-
|
|
463
|
+
CSS 스타일을 이용해 드롭다운을 커스터마이징할 수 있습니다.
|
|
476
464
|
|
|
477
465
|
```tsx
|
|
478
466
|
<Stack direction="row" spacing={2}>
|
|
@@ -527,113 +515,242 @@ Customize borders, shadows, border-radius, and gradients through the `sx` prop.
|
|
|
527
515
|
</Stack>
|
|
528
516
|
```
|
|
529
517
|
|
|
518
|
+
## Component Structure
|
|
519
|
+
|
|
520
|
+
Dropdown은 다음 컴포넌트들과 함께 사용됩니다:
|
|
521
|
+
|
|
522
|
+
```tsx
|
|
523
|
+
<Dropdown>
|
|
524
|
+
<MenuButton>트리거 버튼</MenuButton>
|
|
525
|
+
<Menu>
|
|
526
|
+
<MenuItem>메뉴 아이템 1</MenuItem>
|
|
527
|
+
<MenuItem>메뉴 아이템 2</MenuItem>
|
|
528
|
+
<ListDivider /> {/* 구분선 */}
|
|
529
|
+
<MenuItem>메뉴 아이템 3</MenuItem>
|
|
530
|
+
</Menu>
|
|
531
|
+
</Dropdown>
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### MenuButton Props
|
|
535
|
+
|
|
536
|
+
MenuButton 컴포넌트의 주요 props:
|
|
537
|
+
|
|
538
|
+
- `variant`: `'plain' | 'outlined' | 'soft' | 'solid'`
|
|
539
|
+
- `color`: `'primary' | 'neutral' | 'danger' | 'success' | 'warning'`
|
|
540
|
+
- `size`: `'sm' | 'md' | 'lg'`
|
|
541
|
+
- `startDecorator`: 앞쪽에 표시할 요소
|
|
542
|
+
- `endDecorator`: 뒤쪽에 표시할 요소
|
|
543
|
+
- `disabled`: 비활성 상태
|
|
544
|
+
|
|
545
|
+
### Menu Props
|
|
546
|
+
|
|
547
|
+
Menu 컴포넌트의 주요 props:
|
|
548
|
+
|
|
549
|
+
- `placement`: `'top-start' | 'top' | 'top-end' | 'bottom-start' | 'bottom' | 'bottom-end'`
|
|
550
|
+
- `size`: `'sm' | 'md' | 'lg'`
|
|
551
|
+
- `sx`: 스타일 커스터마이징
|
|
552
|
+
|
|
530
553
|
## Common Use Cases
|
|
531
554
|
|
|
532
555
|
### Navigation Menu
|
|
533
556
|
|
|
534
557
|
```tsx
|
|
535
558
|
<Dropdown>
|
|
536
|
-
<MenuButton variant="plain"
|
|
559
|
+
<MenuButton variant="plain">메뉴</MenuButton>
|
|
537
560
|
<Menu>
|
|
538
|
-
<MenuItem component="a" href="/home">
|
|
539
|
-
|
|
540
|
-
|
|
561
|
+
<MenuItem component="a" href="/home">
|
|
562
|
+
홈
|
|
563
|
+
</MenuItem>
|
|
564
|
+
<MenuItem component="a" href="/about">
|
|
565
|
+
회사소개
|
|
566
|
+
</MenuItem>
|
|
567
|
+
<MenuItem component="a" href="/products">
|
|
568
|
+
제품
|
|
569
|
+
</MenuItem>
|
|
541
570
|
<ListDivider />
|
|
542
|
-
<MenuItem component="a" href="/contact">
|
|
571
|
+
<MenuItem component="a" href="/contact">
|
|
572
|
+
문의하기
|
|
573
|
+
</MenuItem>
|
|
543
574
|
</Menu>
|
|
544
575
|
</Dropdown>
|
|
545
576
|
```
|
|
546
577
|
|
|
547
|
-
###
|
|
578
|
+
### User Profile Menu
|
|
548
579
|
|
|
549
580
|
```tsx
|
|
550
|
-
const [filter, setFilter] = useState('All');
|
|
551
|
-
|
|
552
581
|
<Dropdown>
|
|
553
|
-
<MenuButton
|
|
554
|
-
|
|
555
|
-
startDecorator={<FilterListIcon />}
|
|
556
|
-
endDecorator={<ExpandMoreIcon />}
|
|
557
|
-
>
|
|
558
|
-
Filter: {filter}
|
|
582
|
+
<MenuButton variant="plain" startDecorator={<Avatar size="sm" />} endDecorator={<ExpandMoreIcon />}>
|
|
583
|
+
사용자명
|
|
559
584
|
</MenuButton>
|
|
560
585
|
<Menu>
|
|
561
|
-
<
|
|
562
|
-
|
|
563
|
-
|
|
586
|
+
<Stack px={2} py={1}>
|
|
587
|
+
<Typography level="title-sm">사용자명</Typography>
|
|
588
|
+
<Typography level="body-xs" color="neutral">
|
|
589
|
+
user@example.com
|
|
590
|
+
</Typography>
|
|
591
|
+
</Stack>
|
|
592
|
+
<ListDivider />
|
|
593
|
+
<MenuItem>프로필</MenuItem>
|
|
594
|
+
<MenuItem>설정</MenuItem>
|
|
595
|
+
<ListDivider />
|
|
596
|
+
<MenuItem>로그아웃</MenuItem>
|
|
564
597
|
</Menu>
|
|
565
598
|
</Dropdown>
|
|
566
599
|
```
|
|
567
600
|
|
|
568
|
-
###
|
|
601
|
+
### Filter Dropdown
|
|
569
602
|
|
|
570
603
|
```tsx
|
|
571
|
-
const [
|
|
604
|
+
const [filter, setFilter] = useState('전체');
|
|
572
605
|
|
|
573
|
-
<Dropdown
|
|
574
|
-
<MenuButton
|
|
606
|
+
<Dropdown>
|
|
607
|
+
<MenuButton variant="outlined" startDecorator={<FilterListIcon />} endDecorator={<ExpandMoreIcon />}>
|
|
608
|
+
필터: {filter}
|
|
609
|
+
</MenuButton>
|
|
575
610
|
<Menu>
|
|
576
|
-
<MenuItem onClick={() =>
|
|
577
|
-
<MenuItem onClick={() =>
|
|
611
|
+
<MenuItem onClick={() => setFilter('전체')}>전체</MenuItem>
|
|
612
|
+
<MenuItem onClick={() => setFilter('활성')}>활성</MenuItem>
|
|
613
|
+
<MenuItem onClick={() => setFilter('비활성')}>비활성</MenuItem>
|
|
614
|
+
</Menu>
|
|
615
|
+
</Dropdown>;
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### Action Menu
|
|
619
|
+
|
|
620
|
+
```tsx
|
|
621
|
+
<Dropdown>
|
|
622
|
+
<MenuButton variant="plain" size="sm">
|
|
623
|
+
작업
|
|
624
|
+
</MenuButton>
|
|
625
|
+
<Menu>
|
|
626
|
+
<MenuItem>
|
|
627
|
+
<EditIcon sx={{ mr: 1 }} />
|
|
628
|
+
편집
|
|
629
|
+
</MenuItem>
|
|
630
|
+
<MenuItem>
|
|
631
|
+
<CopyIcon sx={{ mr: 1 }} />
|
|
632
|
+
복사
|
|
633
|
+
</MenuItem>
|
|
634
|
+
<MenuItem color="danger">
|
|
635
|
+
<DeleteIcon sx={{ mr: 1 }} />
|
|
636
|
+
삭제
|
|
637
|
+
</MenuItem>
|
|
578
638
|
</Menu>
|
|
579
639
|
</Dropdown>
|
|
640
|
+
```
|
|
580
641
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
642
|
+
### Language Selector
|
|
643
|
+
|
|
644
|
+
```tsx
|
|
645
|
+
const [language, setLanguage] = useState('한국어');
|
|
646
|
+
|
|
647
|
+
<Dropdown>
|
|
648
|
+
<MenuButton variant="soft" size="sm">
|
|
649
|
+
{language}
|
|
650
|
+
</MenuButton>
|
|
651
|
+
<Menu>
|
|
652
|
+
<MenuItem onClick={() => setLanguage('한국어')}>한국어</MenuItem>
|
|
653
|
+
<MenuItem onClick={() => setLanguage('English')}>English</MenuItem>
|
|
654
|
+
<MenuItem onClick={() => setLanguage('日本語')}>日本語</MenuItem>
|
|
655
|
+
</Menu>
|
|
656
|
+
</Dropdown>;
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
### Sort Options
|
|
660
|
+
|
|
661
|
+
```tsx
|
|
662
|
+
const [sortBy, setSortBy] = useState('이름순');
|
|
663
|
+
|
|
664
|
+
<Dropdown>
|
|
665
|
+
<MenuButton variant="outlined" startDecorator={<SortIcon />} endDecorator={<ExpandMoreIcon />}>
|
|
666
|
+
정렬: {sortBy}
|
|
667
|
+
</MenuButton>
|
|
668
|
+
<Menu>
|
|
669
|
+
<MenuItem onClick={() => setSortBy('이름순')}>이름순</MenuItem>
|
|
670
|
+
<MenuItem onClick={() => setSortBy('날짜순')}>날짜순</MenuItem>
|
|
671
|
+
<MenuItem onClick={() => setSortBy('크기순')}>크기순</MenuItem>
|
|
672
|
+
</Menu>
|
|
673
|
+
</Dropdown>;
|
|
584
674
|
```
|
|
585
675
|
|
|
586
676
|
## Best Practices
|
|
587
677
|
|
|
588
|
-
|
|
678
|
+
1. **명확한 라벨**: MenuButton의 텍스트는 메뉴의 내용을 명확히 나타내야 합니다.
|
|
589
679
|
|
|
590
|
-
|
|
591
|
-
{/* ✅ Good: Simple list -- use MenuButton directly */}
|
|
592
|
-
<MenuButton buttonText="Actions" items={[{ text: 'Edit' }, { text: 'Delete' }]} />
|
|
680
|
+
2. **적절한 아이콘 사용**: 드롭다운임을 나타내는 화살표 아이콘을 사용하세요.
|
|
593
681
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
</Dropdown>
|
|
606
|
-
```
|
|
682
|
+
```tsx
|
|
683
|
+
<MenuButton endDecorator={<ExpandMoreIcon />}>
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
3. **메뉴 아이템 그룹화**: 관련된 메뉴 아이템들은 ListDivider로 구분하세요.
|
|
687
|
+
|
|
688
|
+
4. **키보드 접근성**: 키보드 탐색이 가능하도록 적절한 props를 설정하세요.
|
|
689
|
+
|
|
690
|
+
5. **적절한 배치**: 화면 공간을 고려하여 메뉴의 placement를 설정하세요.
|
|
691
|
+
|
|
692
|
+
6. **로딩 상태**: 필요한 경우 MenuButton에 loading 상태를 표시하세요.
|
|
607
693
|
|
|
608
|
-
|
|
694
|
+
7. **일관된 스타일**: 애플리케이션 전반에서 일관된 드롭다운 스타일을 유지하세요.
|
|
609
695
|
|
|
610
|
-
|
|
611
|
-
|
|
696
|
+
8. **모바일 고려**: 모바일에서도 사용하기 쉽도록 충분한 터치 영역을 확보하세요.
|
|
697
|
+
|
|
698
|
+
## Controlled vs Uncontrolled
|
|
699
|
+
|
|
700
|
+
### Uncontrolled (기본)
|
|
701
|
+
|
|
702
|
+
```tsx
|
|
703
|
+
<Dropdown>
|
|
704
|
+
<MenuButton>메뉴</MenuButton>
|
|
612
705
|
<Menu>
|
|
613
|
-
<MenuItem
|
|
614
|
-
<MenuItem>Duplicate</MenuItem>
|
|
615
|
-
<ListDivider />
|
|
616
|
-
<MenuItem color="danger">Delete</MenuItem>
|
|
706
|
+
<MenuItem>옵션</MenuItem>
|
|
617
707
|
</Menu>
|
|
618
|
-
|
|
708
|
+
</Dropdown>
|
|
709
|
+
```
|
|
619
710
|
|
|
620
|
-
|
|
711
|
+
### Controlled
|
|
621
712
|
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
<MenuButton endDecorator={<ExpandMoreIcon />}>Options</MenuButton>
|
|
713
|
+
```tsx
|
|
714
|
+
const [open, setOpen] = useState(false);
|
|
625
715
|
|
|
626
|
-
|
|
627
|
-
<MenuButton
|
|
628
|
-
|
|
716
|
+
<Dropdown open={open} onOpenChange={(event, isOpen) => setOpen(isOpen)}>
|
|
717
|
+
<MenuButton>메뉴</MenuButton>
|
|
718
|
+
<Menu>
|
|
719
|
+
<MenuItem onClick={() => setOpen(false)}>옵션</MenuItem>
|
|
720
|
+
</Menu>
|
|
721
|
+
</Dropdown>;
|
|
722
|
+
```
|
|
723
|
+
|
|
724
|
+
## Accessibility
|
|
629
725
|
|
|
630
|
-
|
|
726
|
+
Dropdown은 접근성을 위한 기본적인 기능들을 제공합니다:
|
|
631
727
|
|
|
632
|
-
-
|
|
728
|
+
- **키보드 탐색**: Tab, Enter, Escape, 화살표 키 지원
|
|
729
|
+
- **ARIA 속성**: 적절한 ARIA 라벨과 역할 자동 설정
|
|
730
|
+
- **포커스 관리**: 메뉴가 열릴 때 첫 번째 아이템으로 포커스 이동
|
|
731
|
+
- **스크린 리더**: 메뉴의 상태와 옵션들을 적절히 읽어줌
|
|
633
732
|
|
|
634
|
-
|
|
733
|
+
추가적인 접근성을 위해:
|
|
734
|
+
|
|
735
|
+
- 메뉴 아이템에 적절한 라벨 제공
|
|
736
|
+
- 위험한 작업(삭제 등)에 대한 확인 절차 제공
|
|
737
|
+
- 색상에만 의존하지 않는 시각적 피드백
|
|
738
|
+
|
|
739
|
+
## When to Use Dropdown
|
|
740
|
+
|
|
741
|
+
### ✅ 사용하기 좋은 경우
|
|
742
|
+
|
|
743
|
+
- **메뉴 시스템**: 네비게이션이나 컨텍스트 메뉴가 필요할 때
|
|
744
|
+
- **필터링**: 여러 옵션 중 하나를 선택하는 필터가 필요할 때
|
|
745
|
+
- **액션 목록**: 특정 항목에 대한 여러 작업이 있을 때
|
|
746
|
+
- **사용자 메뉴**: 프로필, 설정, 로그아웃 등의 사용자 관련 기능
|
|
747
|
+
- **공간 절약**: 화면 공간이 제한적일 때 여러 옵션을 숨기고 싶을 때
|
|
748
|
+
|
|
749
|
+
### ❌ 사용하지 않는 것이 좋은 경우
|
|
750
|
+
|
|
751
|
+
- **단일 액션**: 하나의 간단한 작업만 있을 때는 일반 Button 사용
|
|
752
|
+
- **긴 폼**: 폼에서는 Select 컴포넌트가 더 적절
|
|
753
|
+
- **항상 보여야 하는 옵션**: 중요한 옵션들은 항상 표시하는 것이 좋음
|
|
754
|
+
- **너무 많은 옵션**: 20개 이상의 옵션이 있다면 다른 UI 패턴 고려
|
|
635
755
|
|
|
636
|
-
|
|
637
|
-
- **ARIA attributes**: Dropdown automatically sets `aria-haspopup`, `aria-expanded`, `role="menu"`, and `role="menuitem"` on the appropriate elements.
|
|
638
|
-
- **Focus management**: When the menu opens, focus moves to the first menu item. When the menu closes, focus returns to the trigger button.
|
|
639
|
-
- **Color is not the only indicator**: When using `color="danger"` on destructive items, pair it with a clear text label (e.g., "Delete") so the meaning is not conveyed by color alone.
|
|
756
|
+
Dropdown은 사용자에게 깔끔하고 직관적인 메뉴 경험을 제공하는 강력한 컴포넌트입니다. 적절히 사용하면 공간을 효율적으로 활용하면서도 풍부한 기능을 제공할 수 있습니다.
|