Something went wrong. Try again.
Monorepo for Tangled
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142<script lang="ts"> import type { Snippet } from "svelte"; import type { HTMLAttributes } from "svelte/elements";
interface Props extends Omit<HTMLAttributes<HTMLDivElement>, "class" | "children"> { label?: string; subtitle?: string; for?: string; required?: boolean; class?: string; children: Snippet<[{ id: string }]>; }
let { label, subtitle, for: forId, required = false, class: className = "", children, ...rest }: Props = $props();
const generatedId = $props.id(); const id = $derived(forId ?? generatedId);</script>
<div class={`flex flex-col gap-1.5 ${className}`} {...rest}> {#if label} <label for={id} class="text-xs font-medium tracking-wide text-foreground-default uppercase"> {label} {#if required} <span class="text-foreground-danger">*</span> {/if} </label> {/if} {@render children({ id })} {#if subtitle} <p class="text-xs text-foreground-muted">{subtitle}</p> {/if}</div>