@ceed/ads 1.29.1 → 1.30.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/ProfileMenu/ProfileMenu.d.ts +1 -1
- package/dist/components/SearchBar/SearchBar.d.ts +21 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/data-display/Badge.md +39 -71
- package/dist/components/data-display/DataTable.md +1 -1
- package/dist/components/data-display/InfoSign.md +98 -74
- package/dist/components/data-display/Typography.md +97 -363
- package/dist/components/feedback/Dialog.md +62 -76
- package/dist/components/feedback/Modal.md +44 -259
- package/dist/components/feedback/llms.txt +0 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/inputs/Autocomplete.md +107 -356
- package/dist/components/inputs/ButtonGroup.md +106 -115
- package/dist/components/inputs/Calendar.md +459 -98
- 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/FilterMenu.md +19 -169
- package/dist/components/inputs/FilterableCheckboxGroup.md +23 -123
- package/dist/components/inputs/IconButton.md +88 -137
- package/dist/components/inputs/Input.md +0 -5
- 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/RadioTileGroup.md +61 -150
- package/dist/components/inputs/SearchBar.md +44 -0
- package/dist/components/inputs/Select.md +326 -222
- package/dist/components/inputs/Switch.md +376 -136
- package/dist/components/inputs/Textarea.md +10 -213
- package/dist/components/inputs/Uploader/Uploader.md +66 -145
- package/dist/components/inputs/llms.txt +1 -3
- package/dist/components/navigation/Breadcrumbs.md +322 -80
- package/dist/components/navigation/Dropdown.md +221 -92
- package/dist/components/navigation/IconMenuButton.md +502 -40
- package/dist/components/navigation/InsetDrawer.md +738 -68
- package/dist/components/navigation/Link.md +298 -39
- 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/ProfileMenu.md +268 -45
- package/dist/components/navigation/Stepper.md +28 -160
- package/dist/components/navigation/Tabs.md +316 -57
- package/dist/components/surfaces/Sheet.md +334 -151
- package/dist/index.browser.js +15 -13
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +289 -288
- package/dist/index.d.ts +1 -1
- package/dist/index.js +426 -369
- package/dist/llms.txt +1 -8
- package/framer/index.js +1 -1
- package/package.json +16 -15
- package/dist/chunks/rehype-accent-FZRUD7VI.js +0 -39
- 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/Slider.md +0 -334
- package/dist/guides/ThemeProvider.md +0 -116
- package/dist/guides/llms.txt +0 -9
|
@@ -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/ads';
|
|
28
|
-
import { MenuButton } from '@ceed/ads';
|
|
27
|
+
import { Dropdown, MenuButton, Menu, MenuItem } from '@ceed/ads';
|
|
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,27 +515,89 @@ 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
|
-
<MenuItem component="a" href="/about"
|
|
540
|
-
<MenuItem component="a" href="/products"
|
|
561
|
+
<MenuItem component="a" href="/home">홈</MenuItem>
|
|
562
|
+
<MenuItem component="a" href="/about">회사소개</MenuItem>
|
|
563
|
+
<MenuItem component="a" href="/products">제품</MenuItem>
|
|
541
564
|
<ListDivider />
|
|
542
|
-
<MenuItem component="a" href="/contact"
|
|
565
|
+
<MenuItem component="a" href="/contact">문의하기</MenuItem>
|
|
543
566
|
</Menu>
|
|
544
567
|
</Dropdown>
|
|
545
568
|
```
|
|
546
569
|
|
|
547
|
-
###
|
|
570
|
+
### User Profile Menu
|
|
548
571
|
|
|
549
572
|
```tsx
|
|
550
|
-
|
|
573
|
+
<Dropdown>
|
|
574
|
+
<MenuButton
|
|
575
|
+
variant="plain"
|
|
576
|
+
startDecorator={<Avatar size="sm" />}
|
|
577
|
+
endDecorator={<ExpandMoreIcon />}
|
|
578
|
+
>
|
|
579
|
+
사용자명
|
|
580
|
+
</MenuButton>
|
|
581
|
+
<Menu>
|
|
582
|
+
<Stack px={2} py={1}>
|
|
583
|
+
<Typography level="title-sm">사용자명</Typography>
|
|
584
|
+
<Typography level="body-xs" color="neutral">
|
|
585
|
+
user@example.com
|
|
586
|
+
</Typography>
|
|
587
|
+
</Stack>
|
|
588
|
+
<ListDivider />
|
|
589
|
+
<MenuItem>프로필</MenuItem>
|
|
590
|
+
<MenuItem>설정</MenuItem>
|
|
591
|
+
<ListDivider />
|
|
592
|
+
<MenuItem>로그아웃</MenuItem>
|
|
593
|
+
</Menu>
|
|
594
|
+
</Dropdown>
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
### Filter Dropdown
|
|
598
|
+
|
|
599
|
+
```tsx
|
|
600
|
+
const [filter, setFilter] = useState('전체');
|
|
551
601
|
|
|
552
602
|
<Dropdown>
|
|
553
603
|
<MenuButton
|
|
@@ -555,85 +605,164 @@ const [filter, setFilter] = useState('All');
|
|
|
555
605
|
startDecorator={<FilterListIcon />}
|
|
556
606
|
endDecorator={<ExpandMoreIcon />}
|
|
557
607
|
>
|
|
558
|
-
|
|
608
|
+
필터: {filter}
|
|
559
609
|
</MenuButton>
|
|
560
610
|
<Menu>
|
|
561
|
-
<MenuItem onClick={() => setFilter('
|
|
562
|
-
<MenuItem onClick={() => setFilter('
|
|
563
|
-
<MenuItem onClick={() => setFilter('
|
|
611
|
+
<MenuItem onClick={() => setFilter('전체')}>전체</MenuItem>
|
|
612
|
+
<MenuItem onClick={() => setFilter('활성')}>활성</MenuItem>
|
|
613
|
+
<MenuItem onClick={() => setFilter('비활성')}>비활성</MenuItem>
|
|
564
614
|
</Menu>
|
|
565
615
|
</Dropdown>
|
|
566
616
|
```
|
|
567
617
|
|
|
568
|
-
###
|
|
618
|
+
### Action Menu
|
|
569
619
|
|
|
570
620
|
```tsx
|
|
571
|
-
|
|
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>
|
|
638
|
+
</Menu>
|
|
639
|
+
</Dropdown>
|
|
640
|
+
```
|
|
641
|
+
|
|
642
|
+
### Language Selector
|
|
572
643
|
|
|
573
|
-
|
|
574
|
-
|
|
644
|
+
```tsx
|
|
645
|
+
const [language, setLanguage] = useState('한국어');
|
|
646
|
+
|
|
647
|
+
<Dropdown>
|
|
648
|
+
<MenuButton variant="soft" size="sm">
|
|
649
|
+
{language}
|
|
650
|
+
</MenuButton>
|
|
575
651
|
<Menu>
|
|
576
|
-
<MenuItem onClick={() =>
|
|
577
|
-
|
|
652
|
+
<MenuItem onClick={() => setLanguage('한국어')}>
|
|
653
|
+
한국어
|
|
654
|
+
</MenuItem>
|
|
655
|
+
<MenuItem onClick={() => setLanguage('English')}>
|
|
656
|
+
English
|
|
657
|
+
</MenuItem>
|
|
658
|
+
<MenuItem onClick={() => setLanguage('日本語')}>
|
|
659
|
+
日本語
|
|
660
|
+
</MenuItem>
|
|
578
661
|
</Menu>
|
|
579
662
|
</Dropdown>
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
### Sort Options
|
|
580
666
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
667
|
+
```tsx
|
|
668
|
+
const [sortBy, setSortBy] = useState('이름순');
|
|
669
|
+
|
|
670
|
+
<Dropdown>
|
|
671
|
+
<MenuButton
|
|
672
|
+
variant="outlined"
|
|
673
|
+
startDecorator={<SortIcon />}
|
|
674
|
+
endDecorator={<ExpandMoreIcon />}
|
|
675
|
+
>
|
|
676
|
+
정렬: {sortBy}
|
|
677
|
+
</MenuButton>
|
|
678
|
+
<Menu>
|
|
679
|
+
<MenuItem onClick={() => setSortBy('이름순')}>이름순</MenuItem>
|
|
680
|
+
<MenuItem onClick={() => setSortBy('날짜순')}>날짜순</MenuItem>
|
|
681
|
+
<MenuItem onClick={() => setSortBy('크기순')}>크기순</MenuItem>
|
|
682
|
+
</Menu>
|
|
683
|
+
</Dropdown>
|
|
584
684
|
```
|
|
585
685
|
|
|
586
686
|
## Best Practices
|
|
587
687
|
|
|
588
|
-
|
|
688
|
+
1. **명확한 라벨**: MenuButton의 텍스트는 메뉴의 내용을 명확히 나타내야 합니다.
|
|
589
689
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
690
|
+
2. **적절한 아이콘 사용**: 드롭다운임을 나타내는 화살표 아이콘을 사용하세요.
|
|
691
|
+
```tsx
|
|
692
|
+
<MenuButton endDecorator={<ExpandMoreIcon />}>
|
|
693
|
+
```
|
|
593
694
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
<Typography level="title-sm">User Name</Typography>
|
|
600
|
-
</Box>
|
|
601
|
-
<ListDivider />
|
|
602
|
-
<MenuItem>Settings</MenuItem>
|
|
603
|
-
<MenuItem>Logout</MenuItem>
|
|
604
|
-
</Menu>
|
|
605
|
-
</Dropdown>
|
|
606
|
-
```
|
|
695
|
+
3. **메뉴 아이템 그룹화**: 관련된 메뉴 아이템들은 ListDivider로 구분하세요.
|
|
696
|
+
|
|
697
|
+
4. **키보드 접근성**: 키보드 탐색이 가능하도록 적절한 props를 설정하세요.
|
|
698
|
+
|
|
699
|
+
5. **적절한 배치**: 화면 공간을 고려하여 메뉴의 placement를 설정하세요.
|
|
607
700
|
|
|
608
|
-
|
|
701
|
+
6. **로딩 상태**: 필요한 경우 MenuButton에 loading 상태를 표시하세요.
|
|
609
702
|
|
|
610
|
-
|
|
611
|
-
|
|
703
|
+
7. **일관된 스타일**: 애플리케이션 전반에서 일관된 드롭다운 스타일을 유지하세요.
|
|
704
|
+
|
|
705
|
+
8. **모바일 고려**: 모바일에서도 사용하기 쉽도록 충분한 터치 영역을 확보하세요.
|
|
706
|
+
|
|
707
|
+
## Controlled vs Uncontrolled
|
|
708
|
+
|
|
709
|
+
### Uncontrolled (기본)
|
|
710
|
+
|
|
711
|
+
```tsx
|
|
712
|
+
<Dropdown>
|
|
713
|
+
<MenuButton>메뉴</MenuButton>
|
|
612
714
|
<Menu>
|
|
613
|
-
<MenuItem
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
715
|
+
<MenuItem>옵션</MenuItem>
|
|
716
|
+
</Menu>
|
|
717
|
+
</Dropdown>
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
### Controlled
|
|
721
|
+
|
|
722
|
+
```tsx
|
|
723
|
+
const [open, setOpen] = useState(false);
|
|
724
|
+
|
|
725
|
+
<Dropdown
|
|
726
|
+
open={open}
|
|
727
|
+
onOpenChange={(event, isOpen) => setOpen(isOpen)}
|
|
728
|
+
>
|
|
729
|
+
<MenuButton>메뉴</MenuButton>
|
|
730
|
+
<Menu>
|
|
731
|
+
<MenuItem onClick={() => setOpen(false)}>옵션</MenuItem>
|
|
617
732
|
</Menu>
|
|
618
|
-
|
|
733
|
+
</Dropdown>
|
|
734
|
+
```
|
|
619
735
|
|
|
620
|
-
|
|
736
|
+
## Accessibility
|
|
621
737
|
|
|
622
|
-
|
|
623
|
-
{/* ✅ Good: Clear dropdown indicator */}
|
|
624
|
-
<MenuButton endDecorator={<ExpandMoreIcon />}>Options</MenuButton>
|
|
738
|
+
Dropdown은 접근성을 위한 기본적인 기능들을 제공합니다:
|
|
625
739
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
740
|
+
- **키보드 탐색**: Tab, Enter, Escape, 화살표 키 지원
|
|
741
|
+
- **ARIA 속성**: 적절한 ARIA 라벨과 역할 자동 설정
|
|
742
|
+
- **포커스 관리**: 메뉴가 열릴 때 첫 번째 아이템으로 포커스 이동
|
|
743
|
+
- **스크린 리더**: 메뉴의 상태와 옵션들을 적절히 읽어줌
|
|
629
744
|
|
|
630
|
-
|
|
745
|
+
추가적인 접근성을 위해:
|
|
631
746
|
|
|
632
|
-
-
|
|
747
|
+
- 메뉴 아이템에 적절한 라벨 제공
|
|
748
|
+
- 위험한 작업(삭제 등)에 대한 확인 절차 제공
|
|
749
|
+
- 색상에만 의존하지 않는 시각적 피드백
|
|
633
750
|
|
|
634
|
-
##
|
|
751
|
+
## When to Use Dropdown
|
|
752
|
+
|
|
753
|
+
### ✅ 사용하기 좋은 경우
|
|
754
|
+
|
|
755
|
+
- **메뉴 시스템**: 네비게이션이나 컨텍스트 메뉴가 필요할 때
|
|
756
|
+
- **필터링**: 여러 옵션 중 하나를 선택하는 필터가 필요할 때
|
|
757
|
+
- **액션 목록**: 특정 항목에 대한 여러 작업이 있을 때
|
|
758
|
+
- **사용자 메뉴**: 프로필, 설정, 로그아웃 등의 사용자 관련 기능
|
|
759
|
+
- **공간 절약**: 화면 공간이 제한적일 때 여러 옵션을 숨기고 싶을 때
|
|
760
|
+
|
|
761
|
+
### ❌ 사용하지 않는 것이 좋은 경우
|
|
762
|
+
|
|
763
|
+
- **단일 액션**: 하나의 간단한 작업만 있을 때는 일반 Button 사용
|
|
764
|
+
- **긴 폼**: 폼에서는 Select 컴포넌트가 더 적절
|
|
765
|
+
- **항상 보여야 하는 옵션**: 중요한 옵션들은 항상 표시하는 것이 좋음
|
|
766
|
+
- **너무 많은 옵션**: 20개 이상의 옵션이 있다면 다른 UI 패턴 고려
|
|
635
767
|
|
|
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.
|
|
768
|
+
Dropdown은 사용자에게 깔끔하고 직관적인 메뉴 경험을 제공하는 강력한 컴포넌트입니다. 적절히 사용하면 공간을 효율적으로 활용하면서도 풍부한 기능을 제공할 수 있습니다.
|