{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "notifications-2",
  "title": "Bell Popover With Badge",
  "description": "Notification bell button carrying an unread count badge that opens a compact popover of avatar rows, mark all read, and a view all link.",
  "dependencies": [
    "@base-ui/react"
  ],
  "registryDependencies": [
    "avatar",
    "badge",
    "button",
    "popover",
    "scroll-area",
    "separator"
  ],
  "files": [
    {
      "path": "registry/blocks/notifications/2/notifications-block.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\"\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport {\n  Popover,\n  PopoverContent,\n  PopoverTrigger,\n} from \"@/components/ui/popover\"\nimport { ScrollArea } from \"@/components/ui/scroll-area\"\nimport { Separator } from \"@/components/ui/separator\"\nimport { IconPlaceholder } from \"@/components/icons/icon-placeholder\"\n\ntype IconProps = { className?: string; size?: number | string }\n\nconst initialNotifications = [\n  {\n    id: 1,\n    icon: (p: IconProps) => (\n      <IconPlaceholder\n        lucide=\"UserPlus\"\n        tabler=\"IconUserPlus\"\n        hugeicons=\"UserAdd01Icon\"\n        phosphor=\"UserPlus\"\n        remixicon=\"RiUserFollowLine\"\n        {...p}\n      />\n    ),\n    initials: \"MK\",\n    name: \"Marco K.\",\n    avatar: \"https://i.pravatar.cc/150?img=14\",\n    title: \"Marco K. started following you\",\n    time: \"Just Now\",\n    unread: true,\n  },\n  {\n    id: 2,\n    icon: (p: IconProps) => (\n      <IconPlaceholder\n        lucide=\"MessageSquare\"\n        tabler=\"IconMessage\"\n        hugeicons=\"Message01Icon\"\n        phosphor=\"Chat\"\n        remixicon=\"RiMessage3Line\"\n        {...p}\n      />\n    ),\n    initials: \"AL\",\n    name: \"Amy L.\",\n    avatar: \"https://i.pravatar.cc/150?img=32\",\n    title: \"Amy L. left a comment on your report\",\n    time: \"5 Min Ago\",\n    unread: true,\n  },\n  {\n    id: 3,\n    icon: (p: IconProps) => (\n      <IconPlaceholder\n        lucide=\"Copy\"\n        tabler=\"IconCopy\"\n        hugeicons=\"CopyIcon\"\n        phosphor=\"Copy\"\n        remixicon=\"RiFileCopyLine\"\n        {...p}\n      />\n    ),\n    initials: \"DS\",\n    name: \"David S.\",\n    avatar: \"https://i.pravatar.cc/150?img=51\",\n    title: \"David S. shared a document with you\",\n    time: \"42 Min Ago\",\n    unread: false,\n  },\n  {\n    id: 4,\n    icon: (p: IconProps) => (\n      <IconPlaceholder\n        lucide=\"Settings\"\n        tabler=\"IconSettings\"\n        hugeicons=\"SettingsIcon\"\n        phosphor=\"GearSix\"\n        remixicon=\"RiSettings4Line\"\n        {...p}\n      />\n    ),\n    initials: \"AC\",\n    name: \"Acme\",\n    avatar: \"https://i.pravatar.cc/150?img=60\",\n    title: \"Acme workspace settings were updated\",\n    time: \"2 Hours Ago\",\n    unread: false,\n  },\n]\n\nexport default function NotificationsBlock() {\n  const [notifications, setNotifications] = React.useState(initialNotifications)\n  const unreadCount = notifications.filter((n) => n.unread).length\n\n  const markAllRead = () =>\n    setNotifications((prev) => prev.map((n) => ({ ...n, unread: false })))\n\n  const markRead = (id: number) =>\n    setNotifications((prev) =>\n      prev.map((n) => (n.id === id ? { ...n, unread: false } : n))\n    )\n\n  return (\n    <section className=\"flex w-full items-center justify-center bg-background px-6 py-12 text-foreground\">\n      <Popover defaultOpen>\n        <PopoverTrigger\n          render={\n            <Button\n              variant=\"outline\"\n              size=\"icon\"\n              className=\"relative shadow-sm transition-shadow hover:shadow-md\"\n            />\n          }\n          aria-label=\"Open notifications\"\n        >\n          <IconPlaceholder\n            lucide=\"Bell\"\n            tabler=\"IconBell\"\n            hugeicons=\"BellIcon\"\n            phosphor=\"Bell\"\n            remixicon=\"RiBellLine\"\n            className=\"size-4\"\n            aria-hidden=\"true\"\n          />\n          {unreadCount > 0 && (\n            <span className=\"absolute -top-1.5 -right-1.5 flex size-4 items-center justify-center rounded-4xl bg-primary text-[9px] leading-none font-bold text-primary-foreground ring-2 ring-background\">\n              {unreadCount}\n            </span>\n          )}\n        </PopoverTrigger>\n\n        <PopoverContent\n          align=\"end\"\n          sideOffset={8}\n          className=\"w-[340px] gap-0 p-0\"\n        >\n          <div className=\"flex items-center justify-between px-4 py-3\">\n            <div className=\"flex items-center gap-2.5\">\n              <span className=\"text-sm font-semibold tracking-tight text-foreground\">\n                Notifications\n              </span>\n              {unreadCount > 0 && (\n                <Badge\n                  variant=\"default\"\n                  className=\"h-5 px-1.5 text-[10px] font-semibold\"\n                >\n                  {unreadCount} New\n                </Badge>\n              )}\n            </div>\n            <Button\n              variant=\"ghost\"\n              size=\"xs\"\n              className=\"text-xs text-muted-foreground transition-colors hover:text-foreground\"\n              onClick={markAllRead}\n              disabled={unreadCount === 0}\n            >\n              Mark All Read\n            </Button>\n          </div>\n\n          <Separator />\n\n          <ScrollArea className=\"max-h-72 [&_[data-slot=scroll-area-viewport]]:scroll-fade-b\">\n            <ul className=\"flex flex-col\">\n              {notifications.map((item, index) => {\n                const Icon = item.icon\n                return (\n                  <li key={item.id}>\n                    <button\n                      type=\"button\"\n                      onClick={() => markRead(item.id)}\n                      className={[\n                        \"group flex w-full items-start gap-3 px-4 py-3 text-left transition-colors hover:bg-muted/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring\",\n                        item.unread ? \"bg-muted/30\" : \"\",\n                      ]\n                        .filter(Boolean)\n                        .join(\" \")}\n                    >\n                      <div className=\"relative mt-0.5 shrink-0\">\n                        <Avatar size=\"sm\" className=\"border border-border\">\n                          <AvatarImage\n                            src={item.avatar}\n                            alt={item.name}\n                            className=\"grayscale\"\n                          />\n                          <AvatarFallback className=\"text-[10px] font-medium\">\n                            {item.initials}\n                          </AvatarFallback>\n                        </Avatar>\n                        <span className=\"absolute -right-1 -bottom-1 flex size-4 items-center justify-center rounded-md border border-border bg-card shadow-sm\">\n                          <Icon className=\"size-2.5 text-muted-foreground\" />\n                        </span>\n                      </div>\n\n                      <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n                        <p\n                          className={[\n                            \"truncate text-xs leading-snug\",\n                            item.unread\n                              ? \"font-medium text-foreground\"\n                              : \"text-foreground/80\",\n                          ].join(\" \")}\n                        >\n                          {item.title}\n                        </p>\n                        <span className=\"text-[10px] text-muted-foreground tabular-nums\">\n                          {item.time}\n                        </span>\n                      </div>\n\n                      <div className=\"mt-1.5 flex size-4 shrink-0 items-center justify-center\">\n                        {item.unread && (\n                          <span\n                            className=\"size-2 bg-primary\"\n                            role=\"img\"\n                            aria-label=\"Unread\"\n                          />\n                        )}\n                      </div>\n                    </button>\n                    {index < notifications.length - 1 && <Separator />}\n                  </li>\n                )\n              })}\n            </ul>\n          </ScrollArea>\n\n          <Separator />\n\n          <div className=\"flex items-center justify-between px-4 py-2.5\">\n            <span className=\"text-[10px] text-muted-foreground\">\n              {unreadCount > 0 ? `${unreadCount} Unread` : \"All Caught Up\"}\n            </span>\n            <Button\n              variant=\"link\"\n              size=\"sm\"\n              className=\"h-auto p-0 text-xs text-muted-foreground transition-colors hover:text-foreground\"\n              render={<a href=\"#\" />}\n              nativeButton={false}\n            >\n              View All\n            </Button>\n          </div>\n        </PopoverContent>\n      </Popover>\n    </section>\n  )\n}\n",
      "type": "registry:component",
      "target": "components/blocks/notifications-2.tsx"
    }
  ],
  "meta": {
    "height": "400px",
    "tier": "free"
  },
  "docs": "Requires a `base-*` style in components.json (the `shadcn init` default). Legacy `new-york`/`radix-*` styles install Radix primitives, which reject the `render` prop this block uses.",
  "categories": [
    "notifications"
  ],
  "type": "registry:block"
}