text input: add asterisk option

This commit is contained in:
Elijah Duffy
2025-09-16 18:28:19 -07:00
parent 02054c3a1f
commit a8c35bdeff

View File

@@ -11,6 +11,7 @@
value?: string;
invalidMessage?: string | null;
ref?: HTMLInputElement | null;
asterisk?: boolean;
class?: ClassValue | null | undefined;
}
@@ -20,6 +21,7 @@
value = $bindable(''),
invalidMessage = 'Field is required',
ref = $bindable<HTMLInputElement | null>(null),
asterisk = false,
class: classValue,
...others
}: Props = $props();
@@ -33,7 +35,12 @@
<div class={['w-full', classValue]}>
{#if label}
<Label for={id}>{label}</Label>
<Label for={id}>
{label}
{#if asterisk}
<span class="text-red-500">*</span>
{/if}
</Label>
{/if}
<StyledRawInput