Skip to content

Hero Section 12

Electric-blue hero with oversized display type, a highlighter sweep, cursor spotlight and an animated bento of stats, chart and terminal.

12 / 12

Installation

Run this in a project that already uses shadcn/ui. The CLI adds the block, its components and npm dependencies.

pnpm dlx shadcn@latest add https://ui.sumansharma.info.np/r/hero-section-12.json
Prefer to iterate with AI?Open in

Usage

The CLI writes the block to components/hero-section-12.tsx. Import it anywhere:

Loading...

Source

The CLI writes this component to components/hero-section-12.tsx.

'use client'

import { useEffect, useRef, useState } from 'react'
import Link from 'next/link'
import { Syne } from 'next/font/google'
import { animate, motion, useInView, useReducedMotion, type Variants } from 'motion/react'
import { ArrowRight, ArrowUpRight, Sparkle } from 'lucide-react'
import { cn } from '@/lib/utils'

const display = Syne({ subsets: ['latin'], weight: ['700', '800'] })

const ease = [0.22, 1, 0.36, 1] as const

const tile: Variants = {
    hidden: { opacity: 0, y: 40, scale: 0.96 },
    show: (i: number) => ({ opacity: 1, y: 0, scale: 1, transition: { delay: 0.5 + i * 0.1, duration: 0.8, ease } }),
}

const lines = ['Ship the', 'ideas that', 'move fast.']

export default function HeroSection() {
    const ref = useRef<HTMLElement>(null)
    const reduce = useReducedMotion()

    // Cursor spotlight: write pointer position into CSS vars, no re-renders.
    const onMove = (e: React.PointerEvent<HTMLElement>) => {
        const el = ref.current
        if (!el || reduce) return
        const r = el.getBoundingClientRect()
        el.style.setProperty('--x', `${e.clientX - r.left}px`)
        el.style.setProperty('--y', `${e.clientY - r.top}px`)
    }

    return (
        <section
            ref={ref}
            onPointerMove={onMove}
            className="relative isolate overflow-hidden bg-[#1f3bff] text-white [--x:70%] [--y:20%]">
            <div
                aria-hidden
                className="absolute inset-0 -z-10">
                <div className="absolute inset-0 bg-[radial-gradient(600px_circle_at_var(--x)_var(--y),rgb(212_255_63/0.22),transparent_60%)] transition-[background] duration-200" />
                <div className="absolute inset-0 bg-[linear-gradient(to_right,rgb(255_255_255/0.08)_1px,transparent_1px),linear-gradient(to_bottom,rgb(255_255_255/0.08)_1px,transparent_1px)] bg-[size:64px_64px] [mask-image:linear-gradient(to_bottom,#000,transparent_85%)]" />
            </div>

            <div className="mx-auto max-w-7xl px-6 pb-16 pt-24 md:pt-28">
                <div className="flex flex-wrap items-end justify-between gap-10">
                    <h1 className={cn(display.className, 'text-[clamp(3rem,9vw,7.5rem)] font-extrabold uppercase leading-[0.9] tracking-[-0.03em]')}>
                        {lines.map((line, i) => (
                            <span
                                key={line}
                                className="block overflow-hidden pb-[0.06em]">
                                <motion.span
                                    className="relative inline-block"
                                    initial={{ y: '110%' }}
                                    animate={{ y: 0 }}
                                    transition={{ delay: i * 0.12, duration: 0.9, ease }}>
                                    {i === 2 ? (
                                        <span className="relative inline-block px-[0.08em]">
                                            {/* Highlighter sweep behind the last line */}
                                            <motion.span
                                                aria-hidden
                                                className="absolute inset-x-0 bottom-[0.08em] top-[0.12em] -z-10 origin-left -skew-x-6 rounded-sm bg-[#d4ff3f]"
                                                initial={{ scaleX: 0 }}
                                                animate={{ scaleX: 1 }}
                                                transition={{ delay: 0.7, duration: 0.7, ease }}
                                            />
                                            <span className="text-[#1f3bff]">{line}</span>
                                        </span>
                                    ) : (
                                        line
                                    )}
                                </motion.span>
                            </span>
                        ))}
                    </h1>

                    <motion.div
                        initial={{ opacity: 0, y: 20 }}
                        animate={{ opacity: 1, y: 0 }}
                        transition={{ delay: 0.5, duration: 0.8, ease }}
                        className="max-w-sm pb-3">
                        <p className="text-lg text-white/80">The launch platform for product teams. Plan, build and release from one bold, ridiculously fast workspace.</p>
                        <div className="mt-7 flex flex-wrap gap-3">
                            <Link
                                href="#"
                                className="group inline-flex h-12 items-center gap-2 rounded-full bg-[#d4ff3f] px-6 font-semibold text-[#0b1033] transition-transform hover:-translate-y-0.5">
                                Get started
                                <span className="flex size-6 items-center justify-center rounded-full bg-[#0b1033] text-[#d4ff3f] transition-transform group-hover:rotate-[-45deg]">
                                    <ArrowRight className="size-3.5" />
                                </span>
                            </Link>
                            <Link
                                href="#"
                                className="inline-flex h-12 items-center rounded-full border border-white/30 px-6 font-medium transition-colors hover:bg-white hover:text-[#1f3bff]">
                                Talk to sales
                            </Link>
                        </div>
                    </motion.div>
                </div>

                {/* Bento */}
                <div className="mt-16 grid gap-4 sm:grid-cols-2 lg:grid-cols-12">
                    <motion.div
                        variants={tile}
                        custom={0}
                        initial="hidden"
                        animate="show"
                        className="relative overflow-hidden rounded-3xl bg-[#d4ff3f] p-6 text-[#0b1033] lg:col-span-3">
                        <p className="text-sm font-medium">Faster releases</p>
                        <p className={cn(display.className, 'mt-8 text-6xl font-extrabold tracking-tight')}>
                            <CountUp to={3.4} decimals={1} />×
                        </p>
                        <p className="mt-2 text-sm opacity-70">median across 2,000 teams</p>
                    </motion.div>

                    <motion.div
                        variants={tile}
                        custom={1}
                        initial="hidden"
                        animate="show"
                        className="rounded-3xl bg-white p-6 text-[#0b1033] lg:col-span-5">
                        <div className="flex items-center justify-between text-sm">
                            <p className="font-medium">Deploys this week</p>
                            <span className="rounded-full bg-[#1f3bff]/10 px-2.5 py-0.5 font-medium text-[#1f3bff]">Live</span>
                        </div>
                        <svg
                            viewBox="0 0 400 120"
                            className="mt-6 h-28 w-full"
                            aria-hidden>
                            {[0, 40, 80].map((y) => (
                                <line
                                    key={y}
                                    x1="0"
                                    x2="400"
                                    y1={y + 20}
                                    y2={y + 20}
                                    stroke="#0b1033"
                                    strokeOpacity=".08"
                                />
                            ))}
                            <motion.path
                                d="M0 100 L50 86 L100 92 L150 60 L200 70 L250 40 L300 48 L350 18 L400 26"
                                fill="none"
                                stroke="#1f3bff"
                                strokeWidth="4"
                                strokeLinejoin="round"
                                strokeLinecap="round"
                                initial={{ pathLength: 0 }}
                                animate={{ pathLength: 1 }}
                                transition={{ delay: 0.9, duration: 1.6, ease: 'easeInOut' }}
                            />
                            <motion.circle
                                cx="350"
                                cy="18"
                                r="7"
                                fill="#d4ff3f"
                                stroke="#1f3bff"
                                strokeWidth="3"
                                initial={{ scale: 0 }}
                                animate={{ scale: 1 }}
                                transition={{ delay: 2.3, type: 'spring', stiffness: 300 }}
                            />
                        </svg>
                    </motion.div>

                    <motion.div
                        variants={tile}
                        custom={2}
                        initial="hidden"
                        animate="show"
                        className="rounded-3xl bg-[#0b1033] p-6 font-mono text-sm lg:col-span-4">
                        <div className="flex gap-1.5">
                            <span className="size-2.5 rounded-full bg-[#ff5f57]" />
                            <span className="size-2.5 rounded-full bg-[#febc2e]" />
                            <span className="size-2.5 rounded-full bg-[#28c840]" />
                        </div>
                        <Typed
                            className="mt-5 block text-white/90"
                            text="$ launch deploy --prod"
                        />
                        <motion.p
                            initial={{ opacity: 0 }}
                            animate={{ opacity: 1 }}
                            transition={{ delay: 2.4 }}
                            className="mt-2 text-white/50">
                            Building 42 routes… done in 3.1s
                        </motion.p>
                        <motion.p
                            initial={{ opacity: 0 }}
                            animate={{ opacity: 1 }}
                            transition={{ delay: 2.8 }}
                            className="mt-1 text-[#d4ff3f]">
                            ✓ Live at launch.app
                        </motion.p>
                    </motion.div>

                    <motion.div
                        variants={tile}
                        custom={3}
                        initial="hidden"
                        animate="show"
                        className="flex items-center justify-between gap-6 rounded-3xl border border-white/20 bg-white/10 p-6 backdrop-blur sm:col-span-2 lg:col-span-12">
                        <p className="max-w-md text-white/80">
                            <Sparkle className="mr-2 inline size-4 fill-[#d4ff3f] text-[#d4ff3f]" />
                            Trusted by product teams at fast-growing startups and Fortune 500s alike.
                        </p>
                        <Link
                            href="#"
                            aria-label="Explore customer stories"
                            className="group relative flex size-24 shrink-0 items-center justify-center">
                            <svg
                                viewBox="0 0 100 100"
                                className="absolute inset-0 size-full motion-safe:animate-[spin_12s_linear_infinite]"
                                aria-hidden>
                                <defs>
                                    <path
                                        id="hero12-circle"
                                        d="M50 50 m-38 0 a38 38 0 1 1 76 0 a38 38 0 1 1 -76 0"
                                    />
                                </defs>
                                <text className="fill-white text-[10.5px] font-semibold uppercase tracking-[0.2em]">
                                    <textPath href="#hero12-circle">Customer stories • Explore •</textPath>
                                </text>
                            </svg>
                            <span className="flex size-10 items-center justify-center rounded-full bg-[#d4ff3f] text-[#0b1033] transition-transform group-hover:scale-110">
                                <ArrowUpRight className="size-4" />
                            </span>
                        </Link>
                    </motion.div>
                </div>
            </div>
        </section>
    )
}

function CountUp({ to, decimals = 0 }: { to: number; decimals?: number }) {
    const ref = useRef<HTMLSpanElement>(null)
    const inView = useInView(ref, { once: true })

    useEffect(() => {
        if (!inView || !ref.current) return
        const node = ref.current
        const controls = animate(0, to, {
            duration: 1.4,
            delay: 0.7,
            ease: 'easeOut',
            onUpdate: (v) => (node.textContent = v.toFixed(decimals)),
        })
        return () => controls.stop()
    }, [inView, to, decimals])

    return (
        <span
            ref={ref}
            className="tabular-nums">
            {(0).toFixed(decimals)}
        </span>
    )
}

function Typed({ text, className }: { text: string; className?: string }) {
    const reduce = useReducedMotion()
    const [count, setCount] = useState(0)

    useEffect(() => {
        if (reduce) return
        let i = 0
        let timer: ReturnType<typeof setTimeout>
        const tick = () => {
            i += 1
            setCount(i)
            if (i < text.length) timer = setTimeout(tick, 45)
        }
        timer = setTimeout(tick, 1000)
        return () => clearTimeout(timer)
    }, [text, reduce])

    const shown = reduce ? text : text.slice(0, count)

    return (
        <span className={className}>
            <span className="sr-only">{text}</span>
            <span aria-hidden>
                {shown}
                <span className="ml-0.5 inline-block h-4 w-2 translate-y-0.5 bg-[#d4ff3f] motion-safe:animate-pulse" />
            </span>
        </span>
    )
}