Lib: Move form stuff into form/ directory

This commit is contained in:
2024-12-18 14:59:55 +01:00
parent 68d9d7e60d
commit 05e32b5ffb
5 changed files with 26 additions and 27 deletions

View File

@ -0,0 +1,26 @@
<script lang="ts">
import type { Snippet } from "svelte";
import type { HTMLInputAttributes } from "svelte/elements";
interface InputProps extends HTMLInputAttributes {
children: Snippet;
/** Manually set the label width, to align multiple inputs vertically. Supply value in CSS units. */
labelwidth?: string;
/** The type of the input element, e.g. "text". */
type?: string;
}
let { children, labelwidth = "auto", type = "text", ...restProps }: InputProps = $props();
</script>
<div class="input-group input-group-divider grid-cols-[auto_1fr_auto]">
<div
class="input-group-shim select-none text-nowrap text-neutral-900"
style="width: {labelwidth};"
>
{@render children()}
</div>
<input {type} {...restProps} />
</div>