Line data Source code
1 : <template>
2 : <div
3 2355 : v-if="text || cssIcon"
4 : class="flex min-w-max items-center gap-1 rounded-sm bg-node px-1 py-0.5 text-xs"
5 : :style="{
6 : color: fgColor,
7 : backgroundColor: bgColor
8 : }"
9 : @click="(e) => onClick?.(e)"
10 : >
11 : {{ text }}
12 : <i v-if="cssIcon" :class="cn('size-3.5', cssIcon)" />
13 : </div>
14 : </template>
15 : <script setup lang="ts">
16 : import type { LGraphBadge } from '@/lib/litegraph/src/LGraphBadge'
17 : import { cn } from '@comfyorg/tailwind-utils'
18 :
19 : export interface NodeBadgeProps {
20 : text: LGraphBadge['text']
21 : fgColor?: LGraphBadge['fgColor']
22 : bgColor?: LGraphBadge['bgColor']
23 : cssIcon?: string
24 : onClick?: (e: MouseEvent) => void
25 : }
26 :
27 : const {
28 : text,
29 : fgColor = 'currentColor',
30 : bgColor = '',
31 : cssIcon
32 : } = defineProps<NodeBadgeProps>()
33 : </script>
|