Navbar 4Retro
pixelflow-ui/navbar-4-retroFreeComponent
pixelflow-ui publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by pixelflow-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://pixelflowui.lok1.dev/r/navbar-4-retro.jsonSource
1"use client";23import React, { useState, useRef, useEffect, useCallback } from "react";4import { useGSAP } from "@gsap/react";5import gsap from "gsap";6import { Draggable, InertiaPlugin } from "gsap/all";7import Link from "next/link";8import { Menu } from "lucide-react";910/**11 * Note: Ensure you have installed gsap: npm install gsap12 */1314const navItems = [15 { label: "PROJECTS", href: "#" },16 { label: "CONTACT", href: "#" },17];1819export function NavbarRetro() {20 gsap.registerPlugin(Draggable, InertiaPlugin);2122 const LOGO_TEXT = "PIXELFLOW_UI";23 const [isNav, setIsNav] = useState(false);24 const refs = useRef([]);25 const [activePillStyle, setActivePillStyle] = useState({ width: 0, left: 0 });26 const navbarRef = useRef(null);2728 const toggleNav = useCallback(() => {29 setIsNav((prev) => !prev);30 }, []);3132 useGSAP(() => {33 const draggables = [];34 LOGO_TEXT.split("").forEach((_item, index) => {35 draggables.push(36 Draggable.create(`.logo-${index}`, {37 bounds: ".nav-wrapper",38 inertia: true,39 })[0]40 );41 });4243 return () => {44 draggables.forEach((d) => d && d.kill());45 };46 }, [isNav]);4748 const handlePillStyle = useCallback((index) => {49 if (!refs.current[index]) return;50 const rect = refs.current[index].getBoundingClientRect();51 const navRect = navbarRef.current.getBoundingClientRect();5253 setActivePillStyle({54 width: rect.width,55 left: rect.left - navRect.left - 4,56 });57 }, []);5859 const resetPillStyle = useCallback(() => {60 setActivePillStyle({ width: 0, left: 0 });61 }, []);6263 return (64 <nav className="w-full flex justify-center items-center absolute top-0 z-30 left-0 navbar-wrapper bg-white border-b-2 border-black font-mono">65 <div className="px-5 md:px-12 py-5 flex items-center gap-4 justify-between w-full z-20">66 <Link67 href="/"68 className="nav-left text-white bg-black border-2 border-black px-4 py-2 font-bold text-sm md:text-xl z-20 whitespace-nowrap uppercase tracking-wider hover:bg-white hover:text-black transition-colors duration-200"69 >70 PIXELFLOW_UI71 </Link>7273 {/* Right side controls */}74 <div75 ref={navbarRef}76 className="z-50 border-2 border-black p-1 md:p-1 flex items-center gap-2 bg-white"77 >78 <div className="relative flex items-center gap-2 md:gap-4">7980 {/* Sliding Block */}81 <div82 style={{83// … truncated
What it pulls in
npm packages
Files it writes
More from pixelflow-ui
All 35 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordion Lyraaccordion-lyra | pixelflow-ui | Components | Free | 3 deps | |
| Accordion Novaaccordion-nova | pixelflow-ui | Components | Free | 3 deps | |
| Accordion Retroaccordion-retro | pixelflow-ui | Components | Free | 3 deps | |
| Background 1background-1 | pixelflow-ui | Components | Free | no deps | |
| Background 1Retrobackground-1-retro | pixelflow-ui | Components | Free | no deps | |
| Bouncy Input Lyrabouncy-input-lyra | pixelflow-ui | Components | Free | 1 dep | |
| Bouncy Input Novabouncy-input-nova | pixelflow-ui | Components | Free | 1 dep | |
| Bouncy Input Retrobouncy-input-retro | pixelflow-ui | Components | Free | 1 dep |
