35 lines
794 B
Svelte
35 lines
794 B
Svelte
<script lang="ts">
|
|||
|
|
import type { Snippet } from 'svelte';
|
||
|
|
|
||
|
|
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger';
|
||
|
|
type ButtonSize = 'sm' | 'md' | 'lg';
|
||
|
|
|
||
|
|
let {
|
||
|
|
children,
|
||
|
|
class: className = '',
|
||
|
|
disabled = false,
|
||
|
|
fullWidth = false,
|
||
|
|
onclick,
|
||
|
|
size = 'md',
|
||
|
|
type = 'button',
|
||
|
|
variant = 'primary'
|
||
|
|
}: {
|
||
|
|
children?: Snippet;
|
||
|
|
class?: string;
|
||
|
|
disabled?: boolean;
|
||
|
|
fullWidth?: boolean;
|
||
|
|
onclick?: (event: MouseEvent) => void;
|
||
|
|
size?: ButtonSize;
|
||
|
|
type?: 'button' | 'submit' | 'reset';
|
||
|
|
variant?: ButtonVariant;
|
||
|
|
} = $props();
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<button
|
||
|
|
class={`sc-button sc-button-${variant} sc-button-${size}${fullWidth ? ' sc-button-full' : ''} ${className}`}
|
||
|
|
{disabled}
|
||
|
|
{onclick}
|
||
|
|
{type}
|
||
|
|
>
|
||
|
|
{@render children?.()}
|
||
|
|
</button>
|