Lib: Add optional tail element to Input component

This commit is contained in:
2025-03-15 00:18:39 +01:00
parent 43e8a00aeb
commit 3a9b4d6834

View File

@ -13,6 +13,8 @@
/** The type of the input element, e.g. "text". */ /** The type of the input element, e.g. "text". */
type?: string; type?: string;
tail?: Snippet;
} }
let { let {
@ -20,6 +22,7 @@
labelwidth = "auto", labelwidth = "auto",
value = $bindable(), value = $bindable(),
type = "text", type = "text",
tail = undefined,
...restProps ...restProps
}: InputProps = $props(); }: InputProps = $props();
</script> </script>
@ -32,4 +35,7 @@
{@render children()} {@render children()}
</div> </div>
<input bind:value class="!outline-none" {type} {...restProps} /> <input bind:value class="!outline-none" {type} {...restProps} />
{#if tail}
{@render tail()}
{/if}
</div> </div>