{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "header-3", "type": "registry:block", "description": "Feature-rich responsive header with scroll blur, animated mobile drawer, and nested navigation menus.", "registryDependencies": [ "button", "navigation-menu" ], "files": [ { "path": "registry/blocks/header/3/header.tsx", "content": "\"use client\";\nimport {\n BarChart,\n CodeIcon,\n FileText,\n GlobeIcon,\n Handshake,\n HelpCircle,\n LayersIcon,\n Leaf,\n type LucideIcon,\n PlugIcon,\n RotateCcw,\n Shield,\n Star,\n UserPlusIcon,\n Users,\n} from \"lucide-react\";\nimport React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Logo } from \"@/components/logo\";\nimport { MenuToggleIcon } from \"@/components/menu-toggle-icon\";\nimport { Button } from \"@/components/ui/button\";\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n} from \"@/components/ui/navigation-menu\";\nimport { useScroll } from \"@/hooks/use-scroll\";\nimport { cn } from \"@/lib/utils\";\n\ntype LinkItem = {\n title: string;\n href: string;\n icon: LucideIcon;\n description?: string;\n};\n\nexport function Header() {\n const [open, setOpen] = React.useState(false);\n const scrolled = useScroll(10);\n\n React.useEffect(() => {\n if (open) {\n document.body.style.overflow = \"hidden\";\n } else {\n document.body.style.overflow = \"\";\n }\n return () => {\n document.body.style.overflow = \"\";\n };\n }, [open]);\n\n return (\n \n \n \n \n
\n Product\n {productLinks.map((link) => (\n \n ))}\n Company\n {companyLinks.map((link) => (\n \n ))}\n {companyLinks2.map((link) => (\n \n ))}\n
\n
\n
\n \n \n
\n \n \n );\n}\n\ntype MobileMenuProps = React.ComponentProps<\"div\"> & {\n open: boolean;\n};\n\nfunction MobileMenu({ open, children, className, ...props }: MobileMenuProps) {\n if (!open || typeof window === \"undefined\") {\n return null;\n }\n\n return createPortal(\n \n \n {children}\n \n ,\n document.body\n );\n}\n\nfunction ListItem({\n title,\n description,\n icon: Icon,\n className,\n href,\n ...props\n}: React.ComponentProps & LinkItem) {\n return (\n \n \n
\n \n
\n
\n {title}\n {description}\n
\n
\n \n );\n}\n\nconst productLinks: LinkItem[] = [\n {\n title: \"Website Builder\",\n href: \"#\",\n description: \"Create responsive websites with ease\",\n icon: GlobeIcon,\n },\n {\n title: \"Cloud Platform\",\n href: \"#\",\n description: \"Deploy and scale apps in the cloud\",\n icon: LayersIcon,\n },\n {\n title: \"Team Collaboration\",\n href: \"#\",\n description: \"Tools to help your teams work better together\",\n icon: UserPlusIcon,\n },\n {\n title: \"Analytics\",\n href: \"#\",\n description: \"Track and analyze your website traffic\",\n icon: BarChart,\n },\n {\n title: \"Integrations\",\n href: \"#\",\n description: \"Connect your apps and services\",\n icon: PlugIcon,\n },\n {\n title: \"API\",\n href: \"#\",\n description: \"Build custom integrations with our API\",\n icon: CodeIcon,\n },\n];\n\nconst companyLinks: LinkItem[] = [\n {\n title: \"About Us\",\n href: \"#\",\n description: \"Learn more about our story and team\",\n icon: Users,\n },\n {\n title: \"Customer Stories\",\n href: \"#\",\n description: \"See how we’ve helped our clients succeed\",\n icon: Star,\n },\n {\n title: \"Partnerships\",\n href: \"#\",\n icon: Handshake,\n description: \"Collaborate with us for mutual growth\",\n },\n];\n\nconst companyLinks2: LinkItem[] = [\n {\n title: \"Terms of Service\",\n href: \"#\",\n icon: FileText,\n },\n {\n title: \"Privacy Policy\",\n href: \"#\",\n icon: Shield,\n },\n {\n title: \"Refund Policy\",\n href: \"#\",\n icon: RotateCcw,\n },\n {\n title: \"Blog\",\n href: \"#\",\n icon: Leaf,\n },\n {\n title: \"Help Center\",\n href: \"#\",\n icon: HelpCircle,\n },\n];\n", "type": "registry:component" }, { "path": "components/logo.tsx", "content": "import type React from \"react\";\n\nexport const LogoIcon = (props: React.ComponentProps<\"svg\">) => (\n \n \n \n \n \n \n);\n\nexport const Logo = (props: React.ComponentProps<\"svg\">) => (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n);\n", "type": "registry:component" }, { "path": "components/menu-toggle-icon.tsx", "content": "\"use client\";\nimport type React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\ntype MenuToggleProps = React.ComponentProps<\"svg\"> & {\n open: boolean;\n duration?: number;\n};\n\nexport function MenuToggleIcon({\n open,\n className,\n fill = \"none\",\n stroke = \"currentColor\",\n strokeWidth = 2.5,\n strokeLinecap = \"round\",\n strokeLinejoin = \"round\",\n duration = 500,\n ...props\n}: MenuToggleProps) {\n return (\n \n \n \n \n );\n}\n", "type": "registry:component" }, { "path": "hooks/use-scroll.ts", "content": "\"use client\";\nimport React from \"react\";\n\nexport function useScroll(threshold: number) {\n const [scrolled, setScrolled] = React.useState(false);\n\n const onScroll = React.useCallback(() => {\n setScrolled(window.scrollY > threshold);\n }, [threshold]);\n\n React.useEffect(() => {\n window.addEventListener(\"scroll\", onScroll);\n return () => window.removeEventListener(\"scroll\", onScroll);\n }, [onScroll]);\n\n // also check on first load\n React.useEffect(() => {\n onScroll();\n }, [onScroll]);\n\n return scrolled;\n}\n", "type": "registry:hook" } ], "meta": { "height": "60vh" }, "categories": [ "header" ] }