mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-29 02:36:35 +00:00
initial commit
This commit is contained in:
32
frontend/src/lib/components/ui/button/button.svelte
Normal file
32
frontend/src/lib/components/ui/button/button.svelte
Normal file
@@ -0,0 +1,32 @@
|
||||
<script lang="ts">
|
||||
import { cn } from '$lib/utils/style.js';
|
||||
import { Button as ButtonPrimitive } from 'bits-ui';
|
||||
import LoaderCircle from 'lucide-svelte/icons/loader-circle';
|
||||
import { type Events, type Props, buttonVariants } from './index.js';
|
||||
|
||||
type $$Props = Props;
|
||||
type $$Events = Events;
|
||||
|
||||
let className: $$Props['class'] = undefined;
|
||||
export let variant: $$Props['variant'] = 'default';
|
||||
export let size: $$Props['size'] = 'default';
|
||||
export let disabled: boolean | undefined | null = false;
|
||||
export let isLoading: $$Props['isLoading'] = false;
|
||||
export let builders: $$Props['builders'] = [];
|
||||
export { className as class };
|
||||
</script>
|
||||
|
||||
<ButtonPrimitive.Root
|
||||
{builders}
|
||||
disabled={isLoading || disabled}
|
||||
class={cn(buttonVariants({ variant, size, className }))}
|
||||
type="button"
|
||||
{...$$restProps}
|
||||
on:click
|
||||
on:keydown
|
||||
>
|
||||
{#if isLoading}
|
||||
<LoaderCircle class="mr-2 h-4 w-4 animate-spin" />
|
||||
{/if}
|
||||
<slot />
|
||||
</ButtonPrimitive.Root>
|
||||
Reference in New Issue
Block a user