3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Floating VueでTooltipを作る

Posted at

Vue3でtooltipやdropdownを作成できるライブラリFloating Vueを使う機会があり
マニュアル通りだと動かず困っていたところ、
cogorさんが助けてくれたので使い方のメモ書きを共有します。
image.png

Vue.js/Tooltip.vue
<template>
  <div class="flex items-start">
    <Tooltip :placement="placement" :triggers="[trigger]" :theme="tooltipStyle">
      <a>Sponsor me</a>
      <template #popper>
        Help me fund my Open Source work!
      </template>
    </Tooltip>
  </div>
</template>

<script lang="ts" setup>
import type { PropType } from 'vue'
import type { TooltipPlacement, TooltipStyle, TooltipTrigger } from './types'
import { Tooltip } from 'floating-vue'
import 'floating-vue/dist/style.css'

const props = defineProps({
    placement: {
      type: String as PropType<TooltipPlacement>,
      default: "top"
    },
    tooltipStyle: {
      type: String as PropType<TooltipStyle>,
      default: "tooltip-dark",
    },
    trigger: {
      type: String as PropType<TooltipTrigger>,
      default: "hover"
    }
})
</script>
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?