forked from themesberg/flowbite-svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGradientButton.svelte
More file actions
47 lines (41 loc) · 1.42 KB
/
GradientButton.svelte
File metadata and controls
47 lines (41 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<script lang="ts">
import { gradientButton } from "./theme";
import clsx from "clsx";
import type { GradientButtonProps } from "$lib";
import Button from "./Button.svelte";
import { getTheme } from "$lib/theme/themeUtils";
import { getButtonGroupContext } from "$lib/context";
const group = getButtonGroupContext()?.size;
let { children, outline, pill, color = "blue", shadow, class: className, href, disabled, size, btnClass, ...restProps }: GradientButtonProps = $props();
const theme = $derived(getTheme("gradientButton"));
const { base, outlineWrapper } = $derived(gradientButton({ color, outline, pill, shadow, disabled, size, group: !!group }));
</script>
{#if outline}
<div class={base({ class: clsx(theme?.base, className) })}>
<Button {...restProps} class={outlineWrapper({ class: clsx(theme?.outlineWrapper, btnClass) })} {disabled} {href} {size}>
{@render children?.()}
</Button>
</div>
{:else}
<Button {...restProps} class={base({ class: clsx(theme?.base, className) })} {disabled} {href} {size}>
{@render children?.()}
</Button>
{/if}
<!--
@component
[Go to docs](https://flowbite-svelte.com/)
## Type
[GradientButtonProps](https://github.com/themesberg/flowbite-svelte/blob/main/src/lib/types.ts#L340)
## Props
@prop children
@prop outline
@prop pill
@prop color = "blue"
@prop shadow
@prop class: className
@prop href
@prop disabled
@prop size
@prop btnClass
@prop ...restProps
-->