tooltip

Tooltip with action button inside

Tooltip with action button inside

Загрузка превью…

src/tooltip/c-tooltip-16.vue

<!--
  Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
  (lucide-react v0.545.0 "bell") — см. docs/PORTING.md §5.
-->
<script setup lang="ts">
import { Button } from "@/components/ui/button"
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
</script>

<template>
  <div class="flex items-center justify-center">
    <TooltipProvider>
      <Tooltip>
        <TooltipTrigger as-child>
          <Button variant="ghost" size="icon" aria-label="Notifications">
            <div class="relative">
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="24"
                height="24"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="2"
                stroke-linecap="round"
                stroke-linejoin="round"
                class="lucide lucide-bell"
              >
                <path d="M10.268 21a2 2 0 0 0 3.464 0" />
                <path
                  d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"
                />
              </svg>
              <span class="bg-destructive absolute -top-1 -right-1 block size-2 rounded-full" />
            </div>
          </Button>
        </TooltipTrigger>
        <TooltipContent>
          <div class="flex flex-col gap-1.5">
            <p class="text-sm font-medium">3 new notifications</p>
            <a href="#" class="text-xs font-medium underline underline-offset-2">View all &rarr;</a>
          </div>
        </TooltipContent>
      </Tooltip>
    </TooltipProvider>
  </div>
</template>

Установка

npx shadcn-vue@latest add https://revueui.rootapi.dev/r/c-tooltip-16.json

Зависимости реестра

Источник: порт из ReUI (Keenthemes, MIT)