UIPin
ComponentsIconsIllustrationsMotionTemplatesApps
Boards
UIPin

Free, open-source UI components, icons, illustrations, motion, templates and apps, in one search. Every item links to its source and licence.

UIPin is free. If it saved you time, you can keep it running:

Buy me a coffee
ComponentsIconsIllustrationsMotionTemplatesAppsLibrariesCompareNew this weekMCP for agentsBoardsPrivacy

Components, icons and artwork belong to their authors and are shown under their open-source licences.

SmoothUI/Header 4

Navigation
1 of 6
Compiling

Theme it

Every preview, live

Brand colour

Corner radius

Font

Recolours shadcn’s tokens, Tailwind’s accent colours and colours set in the code. Red, amber and green classes stay, since they usually mean error, warning or success.

6 versions·1 library

  • Header 4
  • Header 1
  • Header 2
  • Header 3
  • Header 5
  • Header 6

Header 4

Interactive 3D grid hero header inspired by rauno.me 2024

npx shadcn@latest add https://smoothui.dev/r/header-4.json
Open in v0 Docs Repo
Library
SmoothUI
License
MIT
Stack
React · Tailwind CSS · animated · base-ui
Packages
@base-ui/reactclass-variance-authoritylucide-reactmotion
Also adds
index, animated-group, animated-text, hero-header, logos, newsletter-form
Size
277 lines

Code

components/smoothui/header-4/index.tsx

/**
 * Header 4 - Interactive 3D Grid Hero
 *
 * Inspired by the beautiful interactive grid design from rauno.me 2024 website.
 * Features a 3D-perspective grid with customizable hover colors that respond
 * to user interaction, creating an engaging and modern hero section.
 *
 * @see https://rauno.me
 */

"use client";

import SmoothButton from "@/components/smoothui/smooth-button";
import { ExternalLink } from "lucide-react";
import { useEffect, useRef } from "react";
import { AnimatedGroup, AnimatedText, HeroHeader } from "@/components/smoothui/shared";
import styles from "./hero-grid.module.css";

interface InteractiveGridProps {
  hoverColors?: string | [string, string, string, string];
}

const TOTAL_TILES = 1600;
const INITIAL_TILE = 1;
const TILES_TO_CLONE = TOTAL_TILES - INITIAL_TILE;

function InteractiveGrid({ hoverColors }: InteractiveGridProps) {
  const containerRef = useRef<HTMLDivElement>(null);
  const tileRef = useRef<HTMLDivElement>(null);

  useEffect(() => {
    if (!(containerRef.current && tileRef.current)) {
      return;
    }

    // Clone the first tile to create a 40x40 grid (1600 tiles total)
    for (let i = 0; i < TILES_TO_CLONE; i++) {
      const clonedTile = tileRef.current.cloneNode(true);
      containerRef.current.appendChild(clonedTile);
    }
  }, []);

  // Prepare CSS variables for hover colors
  const style = hoverColors
    ? {
        "--hero-grid-hover-color-1": Array.isArray(hoverColors)
          ? hoverColors[0]
          : hoverColors,
        "--hero-grid-hover-color-2": Array.isArray(hoverColors)
          ? (hoverColors[1] ?? hoverColors[0])
          : hoverColors,
        "--hero-grid-hover-color-3": Array.isArray(hoverColors)
          ? (hoverColors[2] ?? hoverColors[0])
          : hoverColors,
        "--hero-grid-hover-color-4": Array.isArray(hoverColors)
          ? (hoverColors[3] ?? hoverColors[0])
          : hoverColors,
      }
    : undefined;

  return (
    <div
      aria-hidden="true"
      className={styles.gridContainer}
      style={style as React.CSSProperties}
    >
      <div className={styles.mainGrid} ref={containerRef}>
        <div className={styles.tile} ref={tileRef} />
      </div>
    </div>
  );
}

interface HeroGridProps {
  hoverColors?: string | [string, string, string, string];
}

export function HeroGrid({ hoverColors }: HeroGridProps) {
  return (
    <div className="relative">
      <HeroHeader />
      <main>
        <section className="relative overflow-hidden py-36">
          {/* Interactive animated grid background */}
          <InteractiveGrid hoverColors={hoverColors} />
          <AnimatedGroup
            className="pointer-events-none flex flex-col items-center gap-6 text-center"
            preset="blur-slide"
          >
            <div>
              <AnimatedText
                as="h1"
                className="mb-6 text-pretty font-bold text-2xl tracking-tight lg:text-5xl"
              >
                Build your next project with{" "}
                <span className="text-brand">SmoothUI</span>
              </AnimatedText>
              <AnimatedText
                as="p"
                className="mx-auto max-w-3xl text-muted-foreground lg:text-xl"
                delay={0.15}
              >
                SmoothUI gives you the building blocks to create stunning,
                animated interfaces in minutes.
              </AnimatedText>
            </div>
            <AnimatedGroup
              className="pointer-events-auto mt-6 flex justify-center gap-3"
              preset="slide"
            >
              <SmoothButton
                className="shadow-sm transition-shadow hover:shadow"
                variant="outline"
              >
                Get Started
              </SmoothButton>
              <SmoothButton className="group" variant="candy">
                Learn more{" "}
                <ExternalLink className="ml-2 h-4 transition-transform group-hover:translate-x-0.5" />
              </SmoothButton>
            </AnimatedGroup>
          </AnimatedGroup>
        </section>
      </main>
    </div>
  );
}

export default HeroGrid;

More like this

Header 1

SmoothUI·Navigation

Questionnaire

HextaUI·Inputs & forms

Features 1

SmoothUI·Cards

Github Inline Comments

Eldora UI·Other

Cool Mode

Magic UI·Buttons

Border Beam Button

Cult UI·Backgrounds

Bento Grid

Magic UI·Cards

Faq 4

SmoothUI·Data display

Live Button

Eldora UI·Buttons

Footer 3

SmoothUI·Navigation

Faq 1

SmoothUI·Data display

Feature Voting

Cult UI·Cards

Animated Shiny Button

Eldora UI·Text effects

Empty

shadcn/ui·Feedback & loaders

Animated Grid Pattern

Magic UI·Backgrounds