feat(DropdownMenu/ContextMenu): handle color field in items (#2510)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Alex
2024-11-06 01:21:01 +05:00
committed by GitHub
parent 2d52834529
commit f66c96e277
16 changed files with 214 additions and 54 deletions

View File

@@ -0,0 +1,33 @@
<script setup lang="ts">
const items = [
[
{
label: 'View',
icon: 'i-heroicons-eye'
},
{
label: 'Copy',
icon: 'i-heroicons-document-duplicate'
},
{
label: 'Edit',
icon: 'i-heroicons-pencil'
}
],
[
{
label: 'Delete',
color: 'error' as const,
icon: 'i-heroicons-trash'
}
]
]
</script>
<template>
<UContextMenu :items="items" class="w-48">
<div class="flex items-center justify-center rounded-md border border-dashed border-[var(--ui-border-accented)] text-sm aspect-video w-72">
Right click here
</div>
</UContextMenu>
</template>

View File

@@ -0,0 +1,35 @@
<script setup lang="ts">
const items = [
[
{
label: 'View',
icon: 'i-heroicons-eye'
},
{
label: 'Copy',
icon: 'i-heroicons-document-duplicate'
},
{
label: 'Edit',
icon: 'i-heroicons-pencil'
}
],
[
{
label: 'Delete',
color: 'error' as const,
icon: 'i-heroicons-trash'
}
]
]
</script>
<template>
<UDropdownMenu :items="items" class="w-48">
<UButton label="Open" color="neutral" variant="outline" icon="i-heroicons-bars-3" />
<template #profile-trailing>
<UIcon name="i-heroicons-check-badge" class="shrink-0 size-5 text-[var(--ui-primary)]" />
</template>
</UDropdownMenu>
</template>