Line data Source code
1 10 : <template>
2 : <button
3 : :type
4 : :disabled="disabled || loading"
5 : :aria-busy="loading || undefined"
6 : :data-variant="variant"
7 : :class="cn(buttonVariants({ variant, size }), customClass)"
8 : >
9 : <i
10 : v-if="loading"
11 : class="icon-[lucide--loader-circle] animate-spin motion-reduce:animate-none"
12 : aria-hidden="true"
13 : />
14 : <template v-if="loading">
15 : <span class="sr-only"><slot /></span>
16 : </template>
17 : <slot v-else />
18 : </button>
19 : </template>
20 :
21 : <script setup lang="ts">
22 : /**
23 : * The cloud app's Button, as a native button: same variant classes, same
24 : * loading treatment (spinner with the label kept for screen readers).
25 : */
26 : import type { HTMLAttributes } from 'vue'
27 :
28 : import type { ButtonVariants } from '@comfyorg/design-system/button.variants'
29 : import { buttonVariants } from '@comfyorg/design-system/button.variants'
30 : import { cn } from '@comfyorg/tailwind-utils'
31 :
32 : const {
33 : type = 'button',
34 : class: customClass = '',
35 : loading = false,
36 : disabled = false
37 : } = defineProps<{
38 : type?: 'button' | 'submit'
39 : variant?: ButtonVariants['variant']
40 : size?: ButtonVariants['size']
41 : class?: HTMLAttributes['class']
42 : loading?: boolean
43 : disabled?: boolean
44 : }>()
45 : </script>
|