Vue Custom Tooltip supports predefined UI framework themes! You can easily apply PrimeVue or Vuetify styling to all your tooltips with a simple configuration option.
default: The built-in theme using the component's original styles (no additional CSS loaded)classic: An alternative skin, using clean stylingsprimevue: Styles inspired by PrimeVue's design systemvuetify: Styles inspired by Vuetify's Material Design implementation
Apply a theme to all tooltips in your application:
import { createApp } from 'vue'
import { VueCustomTooltip } from '@borstihd/vue-custom-tooltip'
import App from './App.vue'
const app = createApp(App)
app.use(VueCustomTooltip, {
theme: 'primevue' // or 'classic', 'vuetify', 'default'
})
app.mount('#app')Combine theme styling with global configuration:
app.use(VueCustomTooltip, {
theme: 'primevue',
globalConfig: {
position: 'top',
trigger: 'hover',
showDelay: 200,
hideDelay: 150,
dark: 'auto', // Supports auto-detection, true, or false
showArrow: true,
offset: 12,
maxWidth: '300px',
},
})If you don't specify a theme, the default tooltip styling will be used:
// These are equivalent
app.use(VueCustomTooltip)
app.use(VueCustomTooltip, { theme: 'default' })You can also change the theme programmatically:
import { getTooltipGlobalTheme, setTooltipGlobalTheme } from '@borstihd/vue-custom-tooltip'
// Change theme at runtime
setTooltipGlobalTheme('vuetify')
// Get current theme
const currentTheme = getTooltipGlobalTheme()
// Revert to default (uses component's built-in styles)
setTooltipGlobalTheme('default')
// or
setTooltipGlobalTheme(undefined)All themes automatically support dark mode through:
- Auto detection (
dark: 'auto'): Responds to Tailwind's.darkclass orprefers-color-scheme - Forced dark mode (
dark: true): Always use dark theme - Forced light mode (
dark: false): Always use light theme
// Auto-detect dark mode
app.use(VueCustomTooltip, {
theme: 'primevue',
globalConfig: {
dark: 'auto', // Default
},
})
// Force dark mode
app.use(VueCustomTooltip, {
theme: 'vuetify',
globalConfig: {
dark: true,
},
})Each theme uses CSS custom properties that you can override in your own styles:
/* Override PrimeVue theme colors */
:root {
--vct-primevue-background: #1a1a1a;
--vct-primevue-text-color: #ffffff;
--vct-primevue-border-radius: 8px;
}
/* Override Vuetify theme colors */
:root {
--vct-vuetify-background: rgba(50, 50, 50, 0.95);
--vct-vuetify-text-color: #e0e0e0;
--vct-vuetify-font-family: 'Custom Font', sans-serif;
}- Themes are injected as
<style>elements in the document<head> - Only one theme can be active at a time
- Changing themes at runtime will automatically remove the previous theme styles
- Themes work with both the component API (
<Tooltip>) and directive API (v-tooltip) - All theme styles respect the tooltip's position, trigger, and other configuration options
See styles/themes/README.md for information on creating your own custom themes.