Docs
下拉菜单
下拉菜单
向用户显示菜单,例如一组操作或由按钮触发的功能。
安装
npx shadcn-ui@latest add dropdown-menu
用法
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
<DropdownMenu>
<DropdownMenuTrigger>打开</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuLabel>我的账户</DropdownMenuLabel>
<DropdownMenuSeparator />
<DropdownMenuItem>个人资料</DropdownMenuItem>
<DropdownMenuItem>账单</DropdownMenuItem>
<DropdownMenuItem>团队</DropdownMenuItem>
<DropdownMenuItem>订阅</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
##示例