Header 1
smoothui-registry/header-1FreeBlock
Modern header block with navigation and mobile menu
Install it
npx shadcn@latest add https://www.smoothui.dev/r/header-1.jsonSource
1"use client";23import { ExternalLink } from "lucide-react";4import { useEffect, useRef, useState } from "react";5import { AnimatedGroup, AnimatedText, Button, HeroHeader } from "@/components/smoothui/shared";6import styles from "./hero-grid.module.css";78const CELL_SIZE = 120; // px9const COLORS = [10 "oklch(0.72 0.2 352.53)", // blue11 "#A764FF",12 "#4B94FD",13 "#FD4B4E",14 "#FF8743",15];1617function getRandomColor() {18 return COLORS[Math.floor(Math.random() * COLORS.length)];19}2021function SubGrid() {22 const [cellColors, setCellColors] = useState<(string | null)[]>([23 null,24 null,25 null,26 null,27 ]);28 // Add refs for leave timeouts29 const leaveTimeouts = useRef<(NodeJS.Timeout | null)[]>([30 null,31 null,32 null,33 null,34 ]);3536 function handleHover(cellIdx: number) {37 // Clear any pending timeout for this cell38 const timeout = leaveTimeouts.current[cellIdx];39 if (timeout) {40 clearTimeout(timeout);41 leaveTimeouts.current[cellIdx] = null;42 }43 setCellColors((prev) =>44 prev.map((c, i) => (i === cellIdx ? getRandomColor() : c))45 );46 }47 function handleLeave(cellIdx: number) {48 // Add a small delay before removing the color49 leaveTimeouts.current[cellIdx] = setTimeout(() => {50 setCellColors((prev) => prev.map((c, i) => (i === cellIdx ? null : c)));51 leaveTimeouts.current[cellIdx] = null;52 }, 120);53 }54 // Cleanup on unmount55 useEffect(56 () => () => {57 for (const t of leaveTimeouts.current) {58 if (t) {59 clearTimeout(t);60 }61 }62 },63 []64 );6566 return (67 <div className={styles.subgrid} style={{ pointerEvents: "none" }}>68 {[0, 1, 2, 3].map((cellIdx) => (69 <button70 className={styles.cell}71 key={cellIdx}72 onMouseEnter={() => handleHover(cellIdx)}73 onMouseLeave={() => handleLeave(cellIdx)}74 style={{75 background: cellColors[cellIdx] || "transparent",76 pointerEvents: "auto",77 }}78 type="button"79 />80 ))}81 </div>82 );83}8485function InteractiveGrid() {86 const containerRef = useRef<HTMLDivElement>(null);87 const [grid, setGrid] = useState({ columns: 0, rows: 0 });8889 useEffect(() => {90 function updateGrid() {91 if (containerRef.current) {92 const { width, height } = containerRef.current.getBoundingClientRect();93 setGrid({94 columns: Math.ceil(width / CELL_SIZE),95 rows: Math.ceil(height / CELL_SIZE),96// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from SmoothUI Registry
All 177 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Chat Templatechat-template | SmoothUI Registry | Blocks | Free | 2 deps · 4 files | |
| Cta 1cta-1 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Cta 2cta-2 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Cta 3cta-3 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Faq 1faq-1 | SmoothUI Registry | Blocks | Free | 2 deps | |
| Faq 2faq-2 | SmoothUI Registry | Blocks | Free | 1 dep | |
| Faq 3faq-3 | SmoothUI Registry | Blocks | Free | 2 deps | |
| Faq 4faq-4 | SmoothUI Registry | Blocks | Free | 2 deps |
