Files
windmill/frontend/src/lib/components/DropdownMenu.svelte
T
2026-02-06 16:02:58 +01:00

38 lines
813 B
Svelte

<script lang="ts">
type Item = {
label: string
icon?: any
right?: string
onClick: () => void
}
type Props = {
closeCallback?: () => void
items: Item[]
}
let { items, closeCallback }: Props = $props()
</script>
<ul class="bg-surface-tertiary rounded-md border w-56 relative drop-shadow-base">
{#each items as item}
<li class="w-full">
<button
class="px-3 h-9 text-xs cursor-pointer hover:bg-surface-hover font-normal w-full text-left flex items-center gap-2.5"
onclick={() => {
item.onClick()
closeCallback?.()
}}
>
{#if item.icon}
<item.icon size="16"></item.icon>
{/if}
<span class="flex-1">
{item.label}
</span>
{#if item.right}
<span class="text-xs text-hint">{item.right}</span>
{/if}
</button>
</li>
{/each}
</ul>