2026-08-04 15:17:15 +02:00
|
|
|
<script lang="ts">
|
2026-09-03 00:14:01 +02:00
|
|
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
2026-08-04 15:17:15 +02:00
|
|
|
import type { Snippet } from 'svelte';
|
|
|
|
|
|
2026-09-03 00:14:01 +02:00
|
|
|
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';
|
|
|
|
|
type ButtonSize = 'sm' | 'md' | 'lg' | 'icon';
|
2026-08-04 15:17:15 +02:00
|
|
|
|
|
|
|
|
let {
|
|
|
|
|
children,
|
|
|
|
|
class: className = '',
|
|
|
|
|
disabled = false,
|
|
|
|
|
fullWidth = false,
|
|
|
|
|
onclick,
|
|
|
|
|
size = 'md',
|
|
|
|
|
type = 'button',
|
2026-09-03 00:14:01 +02:00
|
|
|
variant = 'primary',
|
|
|
|
|
...rest
|
|
|
|
|
}: Omit<HTMLButtonAttributes, 'class' | 'disabled' | 'onclick' | 'type'> & {
|
2026-08-04 15:17:15 +02:00
|
|
|
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}
|
2026-09-03 00:14:01 +02:00
|
|
|
{...rest}
|
2026-08-04 15:17:15 +02:00
|
|
|
>
|
|
|
|
|
{@render children?.()}
|
|
|
|
|
</button>
|