Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add a global variable to set the default delay for tooltips #9571

Closed
MatthewAry opened this issue Nov 4, 2019 · 5 comments
Labels
C: VTooltip framework Issues and Feature Requests that have needs framework-wide. T: feature A new feature
Milestone

Comments

@MatthewAry
Copy link
Contributor

Problem to solve

Tooltips by default have a 0ms delay. Most UIs have a delay on their tooltip so that they appear after a short time to give the user a tip on the UI element they are hovering over. This makes it so that tooltips don't create visual noise for the user.

Proposed solution

If a variable is added to the vuetify plugin constructor which sets the default delay for tooltips, that would be very helpful.

@ghost ghost added the S: triage label Nov 4, 2019
@MajesticPotatoe
Copy link
Member

does open-delay prop not suffice for this, or we talking about some sort of SASS variable?

@MajesticPotatoe MajesticPotatoe added C: VTooltip maybe Functionality that we are considering T: feature A new feature and removed S: triage labels Nov 4, 2019
@MatthewAry
Copy link
Contributor Author

MatthewAry commented Nov 4, 2019

open-delay is something that you have to set for every time you use the tooltip component. The delay is not something that I think is set by css. If we had a global variable then it would help the developer enforce a consistent behavior across tooltips. Without one, the alternative would be to create some sort of global mixin and apply the global mixin variable to the tooltip component each time its used.

@MajesticPotatoe MajesticPotatoe removed the maybe Functionality that we are considering label Nov 4, 2019
@MajesticPotatoe
Copy link
Member

I believe the current option for now would be to create a custom component that extends v-tooltip and has predefined defaults. SASS approach i was more thinking of just setting an animation delay but you can ignore that.

Right now we do not have any abilities to set global component configurations, however this is already on our official roadmap for v2.3 - Orion

@MajesticPotatoe MajesticPotatoe added this to the v2.2.x milestone Nov 4, 2019
@jacekkarczmarczyk jacekkarczmarczyk added the framework Issues and Feature Requests that have needs framework-wide. label Nov 9, 2019
@jacekkarczmarczyk
Copy link
Member

Let's keep the issue with general global config instead of specific prop
#9677

@prajapatidk
Copy link

prajapatidk commented Jul 22, 2022

It is working 100%

First - create custom component for tooltip (CustomTooltip.vue)

<script lang="ts">
import Vue from "vue";
//@ts-ignore
import VTooltip from "vuetify/lib/components/VTooltip/VTooltip";

// Create Base Mixins and Define Custom Properties
const base = Vue.extend({ mixins: [VTooltip] });
export default base.extend({
  name: "CustomTooltip",
  props: {
    closeDelay: {
      type: [Number, String],
      default: 0
    },
    disabled: Boolean,
    openDelay: {
      type: [Number, String],
      default: 1000
    },
    openOnHover: {
      type: Boolean,
      default: true
    },
    openOnFocus: {
      type: Boolean,
      default: true
    },
    tag: {
      type: String,
      default: 'span'
    },
    transition: String
  },
});
</script>

Second - import the custom tooltip component in main.js

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify'
import CustomTooltip from "./components/CustomTooltip.vue"

Vue.config.productionTip = false

Vue.component("CustomTooltip", CustomTooltip)

new Vue({
  router,
  store,
  vuetify,
  render: h => h(App)
}).$mount('#app')

Third - use it any component

<template>
  <v-form ref="form" v-model="valid" lazy-validation class="pa-16">

    <CustomTooltip top class="">
      <template v-slot:activator="{ on, attrs }">
        <v-btn color="primary" dark v-bind="attrs" v-on="on"> Button </v-btn>
      </template>
      <span>Tooltip</span>
    </CustomTooltip>


  </v-form>
</template>

<script>
export default {
  name: "FormFields",
};
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VTooltip framework Issues and Feature Requests that have needs framework-wide. T: feature A new feature
Projects
None yet
Development

No branches or pull requests

4 participants