Search code examples
javascriptvuejs2vuetify.jsv-tooltip

How to make a tooltip with blurred background in Vue.js?


Image How to make something like this? I have tried using v-tooltip and Vuetify but it wasn't a success. Is the best option to make background-color of #body grey and there is no other solution?


Solution

  • I think you want something like the z-index overlay https://vuetifyjs.com/en/components/overlays/#z-index

    You could use that to highlight the button and then trigger the tooltip at the same time.

    <template>
      <v-row justify="center">
        <v-btn
          class="white--text"
          color="teal"
          @click="overlay = !overlay"
        >
          Show Overlay
        </v-btn>
    
        <v-overlay
          :z-index="zIndex"
          :value="overlay"
        >
          <v-btn
            class="white--text"
            color="teal"
            @click="overlay = false"
          >
            Hide Overlay
          </v-btn>
        </v-overlay>
      </v-row>
    </template>
    
    <script>
      export default {
        data: () => ({
          overlay: false,
          zIndex: 0,
        }),
      }
    </script>