Files
svelte-formula12/src/lib/components/Button.svelte

25 lines
506 B
Svelte

<script lang="ts">
let {
children,
color,
submit = false,
href = undefined,
fullwidth = false,
...restProps
} = $props();
</script>
{#if href}
<a {href} class="btn p-2 variant-filled-{color} {fullwidth ? 'w-full' : 'w-auto'}" {...restProps}>
{@render children()}
</a>
{:else}
<button
type={submit ? "submit" : "button"}
class="btn p-2 variant-filled-{color} {fullwidth ? 'w-full' : 'w-auto'}"
{...restProps}
>
{@render children()}
</button>
{/if}