expose html button properties

This commit is contained in:
Elijah Duffy
2025-07-07 15:49:14 -07:00
parent 4b81388636
commit a5aeabebbd

View File

@@ -1,9 +1,9 @@
<script lang="ts">
import type { Snippet } from 'svelte';
import type { ClassValue, MouseEventHandler } from 'svelte/elements';
import type { ClassValue, HTMLButtonAttributes, MouseEventHandler } from 'svelte/elements';
import Spinner from './Spinner.svelte';
interface Props {
interface Props extends Omit<HTMLButtonAttributes, 'type' | 'class'> {
icon?: string;
animate?: boolean;
loading?: boolean;
@@ -12,7 +12,15 @@
onclick?: MouseEventHandler<HTMLButtonElement>;
}
let { icon, animate = true, loading, class: classValue, children, onclick }: Props = $props();
let {
icon,
animate = true,
loading,
class: classValue,
children,
onclick,
...others
}: Props = $props();
let iconElement = $state<HTMLSpanElement | null>(null);
@@ -69,6 +77,7 @@
classValue
]}
onclick={handleButtonClick}
{...others}
>
{@render children()}