Tooltip is {{ isVisible ? 'visible' : 'hidden' }}
+Tooltip is {{ isVisible ? 'visible' : 'hidden' }}
++ Use TooltipControl API to programmatically show/hide tooltips by ID. +
+Import: import { TooltipControl } from 'vue-custom-tooltip'
Usage: TooltipControl.show('id')
const tooltipRef = ref<TooltipExposed | null>(null)
+tooltipRef.value?.show()
+tooltipRef.value?.hide()
+ const isVisible = ref(false)
+// Changes automatically sync
+<Tooltip v-model="isVisible" ...>
+ import { TooltipControl } from 'vue-custom-tooltip'
+TooltipControl.show('controlled-tooltip')
+TooltipControl.hide('controlled-tooltip')
+ + Control tooltips programmatically using refs, v-model, or the TooltipControl API for directives. +
+ + ++
Automatically detects both OS dark mode and Tailwind's .dark class
@@ -66,7 +127,7 @@ function onClick(message: string) {+
Always uses dark/light theme, regardless of system or class settings
diff --git a/src/components/tooltip/Tooltip.vue b/src/components/tooltip/Tooltip.vue index 88c0bdd..d707772 100644 --- a/src/components/tooltip/Tooltip.vue +++ b/src/components/tooltip/Tooltip.vue @@ -40,7 +40,7 @@ * - Unique IDs for tooltip-trigger association */ -import type { TooltipProps, TooltipSlots } from '../../types/tooltip' +import type { TooltipExposed, TooltipProps, TooltipSlots } from '../../types/tooltip' import { computed, nextTick, useSlots, useTemplateRef, watch } from 'vue' import { @@ -61,7 +61,7 @@ import { getTooltipGlobalThemeRef } from '../../config/index' */ // Re-export types for external use -export type { TooltipProps, TooltipSlots } +export type { TooltipExposed, TooltipProps, TooltipSlots } const props = withDefaults(defineProps