open-webui/src/lib/components/common/Dropdown.svelte

41 lines
1.1 KiB
Svelte
Raw Normal View History

2024-03-16 09:57:26 +01:00
<script lang="ts">
import { DropdownMenu } from 'bits-ui';
2024-03-16 10:43:51 +01:00
import { createEventDispatcher } from 'svelte';
2024-03-24 23:43:03 +01:00
import { flyAndScale } from '$lib/utils/transitions';
2024-03-16 10:43:51 +01:00
const dispatch = createEventDispatcher();
2024-03-16 09:57:26 +01:00
</script>
2024-03-16 10:43:51 +01:00
<DropdownMenu.Root
onOpenChange={(state) => {
dispatch('change', state);
}}
>
2024-03-16 09:57:26 +01:00
<DropdownMenu.Trigger>
<slot />
</DropdownMenu.Trigger>
<slot name="content">
<DropdownMenu.Content
class="w-full max-w-[130px] rounded-lg px-1 py-1.5 border border-gray-700 z-50 bg-gray-850 text-white"
sideOffset={8}
side="bottom"
align="start"
2024-03-24 23:43:03 +01:00
transition={flyAndScale}
2024-03-16 09:57:26 +01:00
>
<DropdownMenu.Item class="flex items-center px-3 py-2 text-sm font-medium">
<div class="flex items-center">Profile</div>
</DropdownMenu.Item>
<DropdownMenu.Item class="flex items-center px-3 py-2 text-sm font-medium">
<div class="flex items-center">Profile</div>
</DropdownMenu.Item>
<DropdownMenu.Item class="flex items-center px-3 py-2 text-sm font-medium">
<div class="flex items-center">Profile</div>
</DropdownMenu.Item>
</DropdownMenu.Content>
</slot>
</DropdownMenu.Root>