Norbert de Langen e26712b4cf Add Storybook template components for Svelte Vite CLI
Add Button, Header, and Page components with stories for multiple Svelte variations:
- JavaScript
- Svelte 5 JavaScript
- Svelte 5 TypeScript (3.8 and 4.9)
- TypeScript (4.9)

Include stories, components, and CSS files to support the Storybook template components across different Svelte configurations
2025-03-07 15:37:41 +01:00

30 lines
797 B
Svelte

<script lang="ts">
import './button.css';
interface Props {
/** Is this the principal call to action on the page? */
primary?: boolean;
/** What background color to use */
backgroundColor?: string;
/** How large should the button be? */
size?: 'small' | 'medium' | 'large';
/** Button contents */
label: string;
/** The onclick event handler */
onClick?: () => void;
}
const { primary = false, backgroundColor, size = 'medium', label, onClick }: Props = $props();
</script>
<button
type="button"
class={['storybook-button', `storybook-button--${size}`].join(' ')}
class:storybook-button--primary={primary}
class:storybook-button--secondary={!primary}
style:background-color={backgroundColor}
onclick={onClick}
>
{label}
</button>