← catalogo / elements/dropdowns
TW-EL-DR-03
Tailwind Plus
tailwind/application-ui/elements/dropdowns/03-with-icons
html: questa e' vue, sotto c'e' il sorgente.
@headlessui/vue@heroicons/vue<template>
<Menu as="div" class="relative inline-block">
<MenuButton class="inline-flex w-full justify-center gap-x-1.5 rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-xs inset-ring-1 inset-ring-gray-300 hover:bg-gray-50 dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20">
Options
<ChevronDownIcon class="-mr-1 size-5 text-gray-400 dark:text-gray-500" aria-hidden="true" />
</MenuButton>
<transition enter-active-class="transition ease-out duration-100" enter-from-class="transform opacity-0 scale-95" enter-to-class="transform scale-100" leave-active-class="transition ease-in duration-75" leave-from-class="transform scale-100" leave-to-class="transform opacity-0 scale-95">
<MenuItems class="absolute right-0 z-10 mt-2 w-56 origin-top-right divide-y divide-gray-100 rounded-md bg-white shadow-lg outline-1 outline-black/5 dark:divide-white/10 dark:bg-gray-800 dark:shadow-none dark:-outline-offset-1 dark:outline-white/10">
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900 outline-hidden dark:bg-white/5 dark:text-white' : 'text-gray-700 dark:text-gray-300', 'flex items-center px-4 py-2 text-sm']">
<PencilSquareIcon :class="[active ? 'text-gray-500 dark:text-white' : 'text-gray-400 dark:text-gray-500', 'mr-3 size-5']" aria-hidden="true" />
Edit
</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900 outline-hidden dark:bg-white/5 dark:text-white' : 'text-gray-700 dark:text-gray-300', 'flex items-center px-4 py-2 text-sm']">
<DocumentDuplicateIcon :class="[active ? 'text-gray-500 dark:text-white' : 'text-gray-400 dark:text-gray-500', 'mr-3 size-5']" aria-hidden="true" />
Duplicate
</a>
</MenuItem>
</div>
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900 outline-hidden dark:bg-white/5 dark:text-white' : 'text-gray-700 dark:text-gray-300', 'flex items-center px-4 py-2 text-sm']">
<ArchiveBoxIcon :class="[active ? 'text-gray-500 dark:text-white' : 'text-gray-400 dark:text-gray-500', 'mr-3 size-5']" aria-hidden="true" />
Archive
</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900 outline-hidden dark:bg-white/5 dark:text-white' : 'text-gray-700 dark:text-gray-300', 'flex items-center px-4 py-2 text-sm']">
<ArrowRightCircleIcon :class="[active ? 'text-gray-500 dark:text-white' : 'text-gray-400 dark:text-gray-500', 'mr-3 size-5']" aria-hidden="true" />
Move
</a>
</MenuItem>
</div>
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900 outline-hidden dark:bg-white/5 dark:text-white' : 'text-gray-700 dark:text-gray-300', 'flex items-center px-4 py-2 text-sm']">
<UserPlusIcon :class="[active ? 'text-gray-500 dark:text-white' : 'text-gray-400 dark:text-gray-500', 'mr-3 size-5']" aria-hidden="true" />
Share
</a>
</MenuItem>
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900 outline-hidden dark:bg-white/5 dark:text-white' : 'text-gray-700 dark:text-gray-300', 'flex items-center px-4 py-2 text-sm']">
<HeartIcon :class="[active ? 'text-gray-500 dark:text-white' : 'text-gray-400 dark:text-gray-500', 'mr-3 size-5']" aria-hidden="true" />
Add to favorites
</a>
</MenuItem>
</div>
<div class="py-1">
<MenuItem v-slot="{ active }">
<a href="#" :class="[active ? 'bg-gray-100 text-gray-900 outline-hidden dark:bg-white/5 dark:text-white' : 'text-gray-700 dark:text-gray-300', 'flex items-center px-4 py-2 text-sm']">
<TrashIcon :class="[active ? 'text-gray-500 dark:text-white' : 'text-gray-400 dark:text-gray-500', 'mr-3 size-5']" aria-hidden="true" />
Delete
</a>
</MenuItem>
</div>
</MenuItems>
</transition>
</Menu>
</template>
<script setup>
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue'
import {
ArchiveBoxIcon,
ArrowRightCircleIcon,
ChevronDownIcon,
DocumentDuplicateIcon,
HeartIcon,
PencilSquareIcon,
TrashIcon,
UserPlusIcon,
} from '@heroicons/vue/20/solid'
</script>