impr: improve select menu semantics

This commit is contained in:
James Xylight committed 2025-08-29 16:09:22 -07:00
1 parent f105240559
commit ebf53faa10
13 files changed
+170 -187

No files matched your search

+5 -7
View File
@@ -1,5 +1,5 @@
<script lang="ts">
import type { HTMLAttributes } from 'svelte/elements'
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
interface Props extends HTMLAttributes<HTMLSpanElement> {
for?: string | undefined
@@ -7,7 +7,7 @@
* The `text` prop will take precedence over the slot.
*/
text?: string | undefined
class?: string
class?: ClassValue
children?: import('svelte').Snippet
}
@@ -20,16 +20,14 @@
}: Props = $props()
</script>
<svelte:element
this={forID ? 'label' : 'span'}
<label
{...rest}
for={forID}
class="text-sm text-slate-800 dark:text-zinc-200 font-medium w-full {clazz ||
''}"
class={['text-sm text-slate-800 dark:text-zinc-200 font-medium', clazz]}
>
{#if text}
{text}
{:else if children}
{@render children?.()}
{/if}
</svelte:element>
</label>