mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-17 15:43:28 +02:00
31 lines
945 B
Svelte
31 lines
945 B
Svelte
<script lang="ts">
|
|
import { Menubar as MenubarPrimitive, type WithoutChild } from 'bits-ui';
|
|
import Circle from '@lucide/svelte/icons/circle';
|
|
import { cn } from '$lib/utils.js';
|
|
|
|
let {
|
|
ref = $bindable(null),
|
|
class: className,
|
|
children: childrenProp,
|
|
...restProps
|
|
}: WithoutChild<MenubarPrimitive.RadioItemProps> = $props();
|
|
</script>
|
|
|
|
<MenubarPrimitive.RadioItem
|
|
bind:ref
|
|
class={cn(
|
|
'relative flex cursor-default items-center rounded-sm py-1.5 pr-2 pl-8 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground',
|
|
className
|
|
)}
|
|
{...restProps}
|
|
>
|
|
{#snippet children({ checked })}
|
|
<span class="absolute left-2 flex size-3.5 items-center justify-center">
|
|
{#if checked}
|
|
<Circle class="size-2 fill-current" />
|
|
{/if}
|
|
</span>
|
|
{@render childrenProp?.({ checked })}
|
|
{/snippet}
|
|
</MenubarPrimitive.RadioItem>
|