Dropdown Menu
Dropdown Menu는 버튼을 누르면 아래로 펼쳐지는 동작 메뉴입니다. 주로 계정 메뉴나 더보기 메뉴처럼 자주 쓰지 않는 동작을 한곳에 모아 둘 때 사용됩니다. 항목을 구획으로 나누고 아이콘과 단축키를 함께 표시할 수 있어 메뉴가 길어져도 원하는 항목을 쉽게 찾을 수 있습니다.
State
Code
vue
<script setup>
import { User, CreditCard, LogOut } from '@lucide/vue'
import { ADropdownMenu } from '@mobigen/rnd-design-system'
const sections = [
[
{ label: 'Profile', kbd: '⇧⌘P', icon: User },
{ label: 'Billing', kbd: '⌘B', icon: CreditCard, disabled: true }
],
[{ label: 'Log out', kbd: '⇧⌘Q', icon: LogOut }]
]
function onSelect(item) {
// item은 sections 안의 원소
}
</script>
<template>
<ADropdownMenu label="Open Menu" heading="My Account" :sections="sections" @select="onSelect" />
</template>Props
| 속성 | 값 |
|---|---|
label | String |
heading | String |
sections | Array ({ label, kbd, disabled, icon }[][]) (필수) |
disabled | true, false |
size | sm, md, lg, xl (기본 xl) |
ariaLabel | String |
width | String |
align | start, end |
Events
| 이벤트 | 전달 값 |
|---|---|
select | 선택된 항목 객체 |
Slots
| 슬롯 | 전달 값 |
|---|---|
trigger | 없음 |
Notes
size는 트리거 높이, 좌우 여백, 글자 크기를 같은 값의 AButtonsize와 맞춘다. 툴바에서 AButton 과 나란히 놓을 때 같은 값을 준다.ariaLabel은 트리거 버튼의 접근성 이름이다.trigger슬롯에 글자 없이 아이콘만 넣을 때 준다.- 아이콘만 넣어도 트리거는 좌우 여백이 있는 버튼 모양이다. 정사각형 아이콘 버튼 모양은 지원하지 않는다.