tooltip

Tooltip on notification bell with badge count

Tooltip on notification bell with badge count

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

src/tooltip/c-tooltip-5.vue

<!--
  Расхождение с апстримом: `IconPlaceholder` заменена инлайновым `<svg>`
  (lucide-react v0.545.0 "info"/"arrow-right") — см. docs/PORTING.md §5.
-->
<script setup lang="ts">
import { Badge } from "@/components/reui/badge"
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="outline" 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-info"
              >
                <circle cx="12" cy="12" r="10" />
                <path d="M12 16v-4" />
                <path d="M12 8h.01" />
              </svg>
              <Badge variant="destructive" size="xs" class="absolute -top-3.5 -right-3.5">3</Badge>
            </div>
          </Button>
        </TooltipTrigger>
        <TooltipContent class="p-3">
          <div class="flex flex-col gap-2">
            <div class="flex items-center justify-between gap-2">
              <span class="font-medium">Notifications</span>
              <Badge variant="destructive" size="xs">3 new</Badge>
            </div>
            <div class="flex flex-col gap-1 opacity-80">
              <p>• Sarah commented on your PR</p>
              <p>• Build #421 completed</p>
              <p>• New team member joined</p>
            </div>
            <a href="#" class="flex items-center gap-1 font-medium underline underline-offset-2">
              View all
              <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-arrow-right size-3.5"
              >
                <path d="M5 12h14" />
                <path d="m12 5 7 7-7 7" />
              </svg>
            </a>
          </div>
        </TooltipContent>
      </Tooltip>
    </TooltipProvider>
  </div>
</template>

Установка

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

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

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