Files
shared/packages/web-ui/src/lib/components/Button.svelte
T

36 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>