Navbar 4
pixelflow-ui/navbar-4FreeComponent
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.jsonSource
1"use client";23import React, { useCallback, useState, useRef, useEffect } 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";910const navItems = [11 {12 label: "Lets work",13 href: "/components/navbars",14 },15 {16 label: "Contact",17 href: "/components/navbars",18 },19];2021const Navbar = () => {22 gsap.registerPlugin(Draggable, InertiaPlugin);2324 const LOGO_TEXT = "PIXELFLOWUI";25 const [isNav, setIsNav] = useState(false);26 const refs = useRef([]);27 const [activePillStyle, setActivePillStyle] = useState({ width: 0, left: 0 });28 const navbarRef = useRef(null);2930 const toggleNav = useCallback(() => {31 setIsNav((prev) => !prev);32 }, []);3334 useGSAP(() => {35 const draggables = [];36 LOGO_TEXT.split("").forEach((_item, index) => {37 draggables.push(38 Draggable.create(`.logo-${index}`, {39 bounds: ".nav-wrapper",40 inertia: true,41 })[0]42 );43 });4445 return () => {46 draggables.forEach((d) => d && d.kill());47 };48 }, [isNav]);4950 const handleScroll = useCallback(51 (e) => {52 if (isNav) {53 e.preventDefault();54 e.stopPropagation();55 }56 },57 [isNav]58 );5960 const handlePillStyle = useCallback((index) => {61 if (!refs.current[index]) return;62 const rect = refs.current[index].getBoundingClientRect();63 const navRect = navbarRef.current.getBoundingClientRect();6465 setActivePillStyle({66 width: rect.width,67 left: rect.left - navRect.left - 8,68 });69 }, []);7071 const resetPillStyle = useCallback(() => {72 setActivePillStyle({ width: 0, left: 0 });73 }, []);7475 useEffect(() => {}, []);7677 return (78 <nav className="w-full flex justify-center items-center absolute top-0 z-30 left-0 navbar-wrapper bg-black border-b-[0.6px] border-white/40 h-[100vh]">79 <div className="px-5 md:px-12 py-5 flex items-center gap-4 justify-between w-full z-20">80 <Link81 href="/components/navbars"82 className="nav-left text-black bg-white rounded-full px-4 py-2 font-bold text-sm md:text-xl z-20 whitespace-nowrap"83 >84 PIXELFLOW UI85 </Link>8687 <div88 ref={navbarRef}89 className=" z-50 border-white/50 border-[0.6px] rounded-full p-1 md:p-2 flex items-center gap-2"90 >91 <div className="relative flex items-center gap-2 md:gap-4">92 <div93// … 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 |
