Shailendra Kumar

Hero

Heroes

About

This is animated hero section

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Hero to your project and fits it to your theme.

Code

How Hero is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import React, { useEffect } from "react";
import Hero from "@/components/ui/hero";
import { useHeroAnimation, type HeroData } from "@/lib/utils";


export default function HeroPage() {
  // Business logic - Animation state management
  const {
    isLoaded,
    currentWord,
    setCurrentWord,
    mousePosition,
    isNight,
    toggleMode,
    cycleWords,
  } = useHeroAnimation();

  // Hero data configuration
  const heroData: HeroData = {
    mode: isNight ? "night" : "day",
    badge: {
      text: isNight ? "Under the Stars" : "Welcome to the Future",
      icon: true,
    },
    title: {
      prefix: isNight ? "Dream The" : "Build The",
      animatedWords: ["Innovation", "Excellence", "Future", "Success"],
    },
    subtitle: "Transform your ideas into reality with cutting-edge technology and innovative solutions",
    buttons: {
      primary: {
        text: "Get Started",
        href: "#get-started",
      },
      secondary: {
        text: "Learn More",
        href: "#learn-more",
      },
    },
    stats: [
      { label: "Active Users", value: "10K+" },
      { label: "Projects", value: "500+" },
      { label: "Success Rate", value: "99%" },
      { label: "Countries", value: "50+" },
    ],
    space: {
      showPlanets: true,
      showAstronauts: true,
      showStars: true,
      showShootingStars: true,
      showConstellations: true,
      showMoon: true,
      showAurora: true,
      showISS: true,
      planets: [
        {
          type: "earth",
          position: { top: "12%", left: "10%" },
          size: "medium",
          orbitSpeed: "slow",
        },
        {
          type: "mars",
          position: { bottom: "18%", right: "15%" },
          size: "small",
          orbitSpeed: "medium",
        },
        {
          type: "jupiter",
          position: { bottom: "15%", left: "12%" },
          size: "large",
          orbitSpeed: "fast",
        },
        {
          type: "saturn",
          position: { top: "18%", right: "12%" },
          size: "medium",
          orbitSpeed: "reverse",
        },
      ],
      astronauts: [
        {
          id: "astronaut-1",
          type: "floating",
          position: { top: "30%", right: "12%" },
          animation: "float",
        },
        {
          id: "astronaut-2",
          type: "spacewalk",
          position: { top: "55%", left: "10%" },
          animation: "drift",
        },
        {
          id: "astronaut-3",
          type: "distant",
          position: { bottom: "25%", left: "20%" },
          animation: "slow",
        },
      ],
    },
    particles: {
      enabled: true,
      count: 30,
    },
    background: {
      gradient: "bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900",
      darkGradient: "bg-gradient-to-b from-slate-950 via-indigo-950 to-purple-950",
      showGrid: true,
      showOrbs: true,
    },
  };

  // Event handlers
  const handlePrimaryClick = () => {
    console.log("Primary button clicked!");
    // Add your navigation or action logic here
  };

  const handleSecondaryClick = () => {
    console.log("Secondary button clicked!");
    // Add your navigation or action logic here
  };

  // Word cycling effect
  useEffect(() => {
    const cleanup = cycleWords(heroData.title.animatedWords);
    return cleanup;
  }, [cycleWords, heroData.title.animatedWords]);

  return (
    <Hero
      data={heroData}
      isLoaded={isLoaded}
      currentWord={currentWord}
      mousePosition={mousePosition}
      isNight={isNight}
      onToggleMode={toggleMode}
      onPrimaryClick={handlePrimaryClick}
      onSecondaryClick={handleSecondaryClick}
    />
  );
}

More by Shailendra Kumar

View all
  • Map

    Map

    1.7K
  • social card

    social card

    735
  • Animated 3D Card

    Animated 3D Card

    546
  • Date Picker

    Date Picker

    167
  • Animated Button

    Animated Button

    131
  • Kanban

    Kanban

    106
  • switch

    switch

    97
  • 404 page not found

    404 page not found

    82

More in Heroes

View all
  • SaaS Template

    SaaS Template

    2.4K
  • Responsive Hero Banner

    Responsive Hero Banner

    2K
  • Hero

    Hero

    1.2K
  • Centered Hero with Image Fan

    Centered Hero with Image Fan

    931
  • Editorial Collage Hero

    Editorial Collage Hero

    430
  • Glass Fold

    Glass Fold

    212
  • Minimalist Hero Fashion

    Minimalist Hero Fashion

    285
  • HeroSectionWithGradient

    HeroSectionWithGradient

    336