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-11.jsonPrefer to iterate with AI?Open in
Usage
The CLI writes the block to components/hero-section-11.tsx. Import it anywhere:
Loading...
Source
The CLI writes this component to components/hero-section-11.tsx.
'use client'
import { useEffect, useState } from 'react'
import Link from 'next/link'
import { Fraunces } from 'next/font/google'
import { AnimatePresence, animate, motion, useMotionValue, useReducedMotion, useTransform } from 'motion/react'
import { ArrowUpRight, Star } from 'lucide-react'
import { cn } from '@/lib/utils'
const display = Fraunces({ subsets: ['latin'], weight: ['500', '600'], style: ['normal', 'italic'] })
const words = [
{ text: 'founders', color: '#e8553d' },
{ text: 'creators', color: '#d97706' },
{ text: 'agencies', color: '#db2777' },
{ text: 'dreamers', color: '#0f766e' },
]
const photos = [
'https://images.unsplash.com/photo-1522202176988-66273c2fd55f?auto=format&fit=crop&w=700&q=80',
'https://images.unsplash.com/photo-1600880292203-757bb62b4baf?auto=format&fit=crop&w=700&q=80',
'https://images.unsplash.com/photo-1531482615713-2afd69097998?auto=format&fit=crop&w=700&q=80',
]
const avatars = [
'https://images.unsplash.com/photo-1494790108377-be9c29b29330?auto=format&fit=crop&w=96&h=96&q=80',
'https://images.unsplash.com/photo-1500648767791-00dcc994a43e?auto=format&fit=crop&w=96&h=96&q=80',
'https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?auto=format&fit=crop&w=96&h=96&q=80',
]
const logos = ['Northwind', 'Lumen', 'Basecamp Co.', 'Orbit', 'Fieldnote', 'Kite & Key', 'Saltworks', 'Parallel']
const ease = [0.22, 1, 0.36, 1] as const
// Fan of cards: resting pose and the spread pose on hover.
const fan = [
{ rest: { rotate: -10, x: -40, y: 20 }, spread: { rotate: -16, x: -120, y: 30 } },
{ rest: { rotate: 4, x: 30, y: -10 }, spread: { rotate: 0, x: 0, y: -24 } },
{ rest: { rotate: 12, x: 90, y: 40 }, spread: { rotate: 18, x: 130, y: 50 } },
]
export default function HeroSection() {
const reduce = useReducedMotion()
const [index, setIndex] = useState(0)
const [hover, setHover] = useState(false)
useEffect(() => {
if (reduce) return
const id = setInterval(() => setIndex((i) => (i + 1) % words.length), 2200)
return () => clearInterval(id)
}, [reduce])
const current = words[index]
return (
<section className="relative isolate overflow-hidden bg-[#fff6ec] text-[#2a1710]">
<div
aria-hidden
className="absolute inset-0 -z-10">
<div className="absolute -right-40 -top-40 size-[40rem] rounded-full bg-[radial-gradient(circle,#ffc9a8,transparent_65%)]" />
<div className="absolute -bottom-60 -left-40 size-[36rem] rounded-full bg-[radial-gradient(circle,#ffd6e3,transparent_65%)]" />
<div className="absolute inset-0 bg-[radial-gradient(#2a171012_1px,transparent_1px)] [background-size:22px_22px]" />
</div>
<div className="mx-auto grid max-w-6xl items-center gap-16 px-6 pb-16 pt-24 md:pt-32 lg:grid-cols-[minmax(0,1.05fr)_minmax(0,1fr)]">
<div>
<motion.p
initial={{ opacity: 0, y: 12 }}
animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.6, ease }}
className="inline-flex items-center gap-2 rounded-full border border-[#2a1710]/10 bg-white/70 px-3 py-1 text-sm backdrop-blur">
<span className="relative flex size-2">
<span className="absolute inline-flex size-full rounded-full bg-[#e8553d] opacity-60 motion-safe:animate-ping" />
<span className="relative inline-flex size-2 rounded-full bg-[#e8553d]" />
</span>
Now booking spring projects
</motion.p>
<motion.h1
initial={{ opacity: 0, y: 24 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.1, duration: 0.8, ease }}
className={cn(display.className, 'mt-6 text-5xl font-medium leading-[1.02] tracking-[-0.02em] sm:text-6xl lg:text-7xl')}>
Websites that win over{' '}
<span className="relative inline-grid h-[1.1em] overflow-hidden align-bottom">
{/* Invisible longest word reserves the width so the line never jumps. */}
<span
aria-hidden
className="invisible col-start-1 row-start-1 italic">
dreamers.
</span>
<AnimatePresence
mode="popLayout"
initial={false}>
<motion.span
key={current.text}
initial={{ y: '100%', opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
exit={{ y: '-100%', opacity: 0 }}
transition={{ duration: 0.6, ease }}
style={{ color: current.color }}
className="col-start-1 row-start-1 italic">
{current.text}.
</motion.span>
</AnimatePresence>
</span>
</motion.h1>
<motion.p
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.25, duration: 0.8, ease }}
className="mt-6 max-w-lg text-pretty text-lg text-[#2a1710]/70">
A small studio designing warm, fast, conversion-focused sites. Strategy, design and build, delivered in six weeks.
</motion.p>
<motion.div
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 0.4, duration: 0.8, ease }}
className="mt-9 flex flex-wrap items-center gap-3">
<Link
href="#"
className="group inline-flex h-12 items-center gap-2 rounded-full bg-[#e8553d] px-6 font-medium text-white shadow-[0_12px_30px_-10px_#e8553d] transition-all hover:-translate-y-0.5 hover:bg-[#d94a33]">
Book a discovery call
<ArrowUpRight className="size-4 transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5" />
</Link>
<Link
href="#"
className="inline-flex h-12 items-center rounded-full px-5 font-medium underline decoration-[#e8553d]/40 decoration-2 underline-offset-[6px] transition-colors hover:decoration-[#e8553d]">
See our work
</Link>
</motion.div>
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ delay: 0.6, duration: 0.8 }}
className="mt-10 flex items-center gap-4">
<div className="flex -space-x-3">
{avatars.map((src) => (
<img
key={src}
src={src}
alt=""
className="size-10 rounded-full border-2 border-[#fff6ec] object-cover"
/>
))}
</div>
<div className="text-sm">
<div
className="flex gap-0.5 text-[#f59e0b]"
aria-label="Rated 5 out of 5">
{Array.from({ length: 5 }).map((_, i) => (
<Star
key={i}
className="size-4 fill-current"
/>
))}
</div>
<p className="mt-0.5 text-[#2a1710]/70">Loved by 120+ teams</p>
</div>
</motion.div>
</div>
{/* Fanned photo cards that spread on hover */}
<div
className="relative mx-auto h-[26rem] w-full max-w-md sm:h-[30rem]"
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}>
{photos.map((src, i) => (
<motion.div
key={src}
initial={{ opacity: 0, y: 80, rotate: 0 }}
animate={{ opacity: 1, ...(hover && !reduce ? fan[i].spread : fan[i].rest) }}
transition={{ type: 'spring', stiffness: 120, damping: 16, delay: hover ? 0 : 0.3 + i * 0.12 }}
className="absolute left-1/2 top-1/2 -ml-[7.5rem] -mt-[10rem] h-[20rem] w-[15rem] overflow-hidden rounded-3xl border-[6px] border-white bg-white shadow-[0_30px_60px_-20px_rgb(42_23_16/0.35)]"
style={{ zIndex: i === 1 ? 3 : i }}>
<img
src={src}
alt=""
className="size-full rounded-[1.1rem] object-cover"
/>
</motion.div>
))}
<motion.div
initial={{ opacity: 0, scale: 0.8, y: 20 }}
animate={{ opacity: 1, scale: 1, y: 0 }}
transition={{ delay: 1, type: 'spring', stiffness: 180, damping: 16 }}
className="absolute -bottom-2 left-0 z-10 rounded-2xl bg-[#2a1710] px-5 py-4 text-white shadow-2xl sm:left-2">
<p className="text-xs text-white/60">Avg. conversion lift</p>
<p className={cn(display.className, 'text-3xl font-semibold')}>
+<Counter to={38} />%
</p>
</motion.div>
<motion.div
initial={{ opacity: 0, scale: 0.6 }}
animate={{ opacity: 1, scale: 1 }}
transition={{ delay: 1.2, type: 'spring', stiffness: 200, damping: 14 }}
className="absolute -right-2 top-4 z-10 flex size-20 items-center justify-center rounded-full bg-[#ffcf4a] text-center text-xs font-semibold leading-tight shadow-xl sm:right-0">
6-week
<br />
launch
</motion.div>
</div>
</div>
{/* Logo marquee */}
<div className="border-t border-[#2a1710]/10 py-6 [mask-image:linear-gradient(to_right,transparent,#000_15%,#000_85%,transparent)]">
<div className="flex w-max gap-14 motion-safe:animate-[hero11-marquee_30s_linear_infinite]">
{[...logos, ...logos].map((name, i) => (
<span
key={i}
aria-hidden={i >= logos.length}
className={cn(display.className, 'whitespace-nowrap text-xl font-medium text-[#2a1710]/40')}>
{name}
</span>
))}
</div>
</div>
<style>{`@keyframes hero11-marquee { to { transform: translateX(-50%); } }`}</style>
</section>
)
}
function Counter({ to }: { to: number }) {
const value = useMotionValue(0)
const rounded = useTransform(value, (v) => Math.round(v))
const [n, setN] = useState(0)
useEffect(() => {
const controls = animate(value, to, { duration: 1.6, delay: 1.1, ease: 'easeOut' })
const unsub = rounded.on('change', setN)
return () => {
controls.stop()
unsub()
}
}, [to, value, rounded])
return <span className="tabular-nums">{n}</span>
}
More hero section blocks
View all 12 →- Hero Section 101Dark hero with an animated headline, announcement pill, dual CTAs, a product screenshot and a logo strip.
- Hero Section 202Centered hero with animated text, a floating header and a light/dark product screenshot.
- Hero Section 303Minimal hero with an email capture form, animated copy and a customer logo cloud.
- Hero Section 404Split hero with a bold headline, abstract artwork and an infinite logo slider.
- Hero Section 505Full-bleed video hero with a sticky header and an infinite logo slider.
- Hero Section 606Product hero with a newsletter input, announcement link and an app screenshot.