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