Line data Source code
1 : <template>
2 221 : <div
3 : :class="
4 : cn(
5 : 'm-0 flex items-center justify-between px-3 py-0 pt-5',
6 : collapsible && 'cursor-pointer select-none'
7 : )
8 : "
9 : @click="collapsible && toggleCollapse()"
10 : >
11 : <h3 class="m-0 text-xs font-bold text-muted-foreground uppercase">
12 : {{ title }}
13 : </h3>
14 : <i
15 : v-if="collapsible"
16 : :class="
17 : cn(
18 : 'size-3 text-muted-foreground transition-transform duration-200',
19 : isCollapsed
20 : ? 'icon-[lucide--chevron-right]'
21 : : 'icon-[lucide--chevron-down]'
22 : )
23 : "
24 : />
25 : </div>
26 : </template>
27 :
28 : <script setup lang="ts">
29 : import { computed } from 'vue'
30 :
31 : import { cn } from '@comfyorg/tailwind-utils'
32 :
33 : const {
34 : title,
35 : modelValue = false,
36 : collapsible = false
37 : } = defineProps<{
38 : title: string
39 : modelValue?: boolean
40 : collapsible?: boolean
41 : }>()
42 :
43 220 : const emit = defineEmits<{
44 : 'update:modelValue': [value: boolean]
45 : }>()
46 :
47 220 : const isCollapsed = computed({
48 : get: () => modelValue,
49 : set: (value: boolean) => emit('update:modelValue', value)
50 : })
51 :
52 220 : const toggleCollapse = () => {
53 0 : isCollapsed.value = !isCollapsed.value
54 : }
55 : </script>
|