Coves frontend - a photon fork
1<script lang="ts">
2 import type { Snippet } from 'svelte'
3 import type { ClassValue, HTMLAttributes } from 'svelte/elements'
4
5 interface Props extends HTMLAttributes<HTMLSpanElement> {
6 for?: string | undefined
7 /**
8 * The `text` prop will take precedence over the slot.
9 */
10 text?: string | undefined
11 class?: ClassValue
12 customText?: Snippet
13 }
14
15 let {
16 for: forID = undefined,
17 text = undefined,
18 class: clazz = '',
19 customText,
20 children,
21 ...rest
22 }: Props = $props()
23</script>
24
25<svelte:element
26 this={text || customText ? 'label' : 'h3'}
27 {...rest}
28 for={forID}
29 class={['text-sm text-slate-800 dark:text-zinc-200 font-medium', clazz]}
30>
31 {#if text}
32 <div class="inline-block">{text}</div>
33 {:else if customText}
34 {@render customText?.()}
35 {/if}
36 {@render children?.()}
37</svelte:element>