dropdown-menu
Dropdown menu with checkboxes
Dropdown menu with checkboxes
Загрузка превью…
src/dropdown-menu/c-dropdown-menu-6.vue
<!--
Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
(lucide-react v0.545.0 "panels-top-left"/"activity"/"panel-left") — см.
docs/PORTING.md §5. `checked`/`onCheckedChange` (Radix) → `v-model`
(reka-ui `modelValue`), см. docs/PORTING.md.
-->
<script setup lang="ts">
import { ref } from "vue"
import { Button } from "@/components/ui/button"
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
const showStatusBar = ref(true)
const showActivityBar = ref(false)
const showPanel = ref(false)
</script>
<template>
<div class="flex items-center justify-center">
<DropdownMenu>
<DropdownMenuTrigger as-child>
<Button variant="outline" class="w-fit">Checkboxes</Button>
</DropdownMenuTrigger>
<DropdownMenuContent class="min-w-40">
<DropdownMenuGroup>
<DropdownMenuLabel>Appearance</DropdownMenuLabel>
<DropdownMenuCheckboxItem v-model="showStatusBar">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout">
<rect width="18" height="18" x="3" y="3" rx="2" />
<path d="M3 9h18" />
<path d="M9 21V9" />
</svg>
Status Bar
</DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem v-model="showActivityBar" disabled>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-activity">
<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2" />
</svg>
Activity Bar
</DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem v-model="showPanel">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-panel-left">
<rect width="18" height="18" x="3" y="3" rx="2" />
<path d="M9 3v18" />
</svg>
Panel
</DropdownMenuCheckboxItem>
</DropdownMenuGroup>
</DropdownMenuContent>
</DropdownMenu>
</div>
</template>
Установка
npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-dropdown-menu-6.jsonЗависимости реестра
Источник: порт из ReUI (Keenthemes, MIT)