pass through props to div on input

This commit is contained in:
Benjamin Palko 2024-12-13 10:13:58 -05:00
parent afc6b2b338
commit 0b267552fe
3 changed files with 11 additions and 7 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -61,6 +61,7 @@
"graphql-yoga": "^5.10.4", "graphql-yoga": "^5.10.4",
"pino": "^9.5.0", "pino": "^9.5.0",
"pino-pretty": "^13.0.0", "pino-pretty": "^13.0.0",
"tailwind-merge": "^2.5.5",
"zod": "^3.24.0" "zod": "^3.24.0"
} }
} }

View file

@ -1,14 +1,17 @@
<script lang="ts"> <script lang="ts">
import type { HTMLInputTypeAttribute } from 'svelte/elements'; import type { HTMLAttributes, HTMLInputTypeAttribute } from 'svelte/elements';
import { twMerge } from 'tailwind-merge';
let { type InputProps = {
label, label?: string;
name, name: string;
type = 'text' type?: HTMLInputTypeAttribute;
}: { label?: string; name: string; type?: HTMLInputTypeAttribute } = $props(); } & HTMLAttributes<HTMLDivElement>;
let { label, name, type = 'text', ...props }: InputProps = $props();
</script> </script>
<div class="hestia-input"> <div {...props} class={twMerge('hestia-input', props.class)}>
{#if label} {#if label}
<label for={name}>{label}</label> <label for={name}>{label}</label>
<div class="line"></div> <div class="line"></div>