Files
classroomio/packages/ui/src/custom/underline-tabs/underline-tabs.svelte
T

34 lines
760 B
Svelte
Raw Normal View History

2025-12-05 17:20:55 +01:00
<script lang="ts">
import { Tabs as TabsPrimitive } from 'bits-ui';
import { cn } from '../../tools';
import { useUnderlineTabs } from './underline-tabs-utils.svelte';
2025-12-05 17:20:55 +01:00
import { box } from 'svelte-toolbelt';
const uid = $props.id();
let {
ref = $bindable(null),
value = $bindable(''),
id = uid,
class: className,
...restProps
}: Omit<TabsPrimitive.RootProps, 'orientation' | 'id'> & { id?: string } = $props();
useUnderlineTabs({
value: box.with(
() => value,
(v) => (value = v)
),
id: box.with(() => id)
});
</script>
<TabsPrimitive.Root
bind:ref
bind:value
orientation="horizontal"
data-slot="underline-tabs"
class={cn('ui:flex ui:flex-col ui:gap-2', className)}
{...restProps}
/>