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-3.jsonPrefer to iterate with AI?Open in
Usage
The CLI writes the block to components/hero-section.tsx. Import it anywhere:
Loading...
Source
The CLI writes this component to components/hero-section.tsx.
import React from 'react'
import { Mail, SendHorizonal } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { TextEffect } from '@/components/motion-primitives/text-effect'
import { AnimatedGroup } from '@/components/motion-primitives/animated-group'
import { HeroHeader } from '@/components/hero5-header'
import { LogoCloud } from '@/components/logo-cloud'
const transitionVariants = {
item: {
hidden: {
opacity: 0,
filter: 'blur(12px)',
y: 12,
},
visible: {
opacity: 1,
filter: 'blur(0px)',
y: 0,
transition: {
type: 'spring',
bounce: 0.3,
duration: 1.5,
// A spring overshoots below 0, and negative blur() is invalid.
filter: { type: 'tween', ease: 'easeOut', duration: 1 },
},
},
},
}
export default function HeroSection() {
return (
<>
<HeroHeader />
<main className="overflow-hidden [--color-primary-foreground:var(--color-white)] [--color-primary:var(--color-green-600)]">
<section>
<div className="relative mx-auto max-w-6xl px-6 pb-20 pt-32 lg:pt-48">
<div className="relative z-10 mx-auto max-w-4xl text-center">
<TextEffect
preset="fade-in-blur"
speedSegment={0.3}
as="h1"
className="text-balance text-5xl font-medium md:text-6xl">
Healthier daily routine
</TextEffect>
<TextEffect
per="line"
preset="fade-in-blur"
speedSegment={0.3}
delay={0.5}
as="p"
className="mx-auto mt-6 max-w-2xl text-pretty text-lg">
Tailwindcss highly customizable components for building modern websites and applications that look and feel the way you mean it.
</TextEffect>
<AnimatedGroup
variants={{
container: {
visible: {
transition: {
staggerChildren: 0.05,
delayChildren: 0.75,
},
},
},
...transitionVariants,
}}
className="mt-12">
<form
action=""
className="mx-auto max-w-sm">
<div className="bg-background has-[input:focus]:ring-muted relative grid grid-cols-[1fr_auto] items-center rounded-[calc(var(--radius)+0.5rem)] border pr-2 shadow shadow-zinc-950/5 has-[input:focus]:ring-2">
<Mail className="pointer-events-none absolute inset-y-0 left-4 my-auto size-4" />
<input
placeholder="Your mail address"
className="h-12 w-full bg-transparent pl-12 focus:outline-none"
type="email"
/>
<div className="md:pr-1.5 lg:pr-0">
<Button
aria-label="submit"
size="sm"
className="rounded-(--radius)">
<span className="hidden md:block">Get Started</span>
<SendHorizonal
className="relative mx-auto size-5 md:hidden"
strokeWidth={2}
/>
</Button>
</div>
</div>
</form>
<div
aria-hidden
className="bg-radial from-primary/50 dark:from-primary/25 relative mx-auto mt-32 max-w-2xl to-transparent to-55% text-left">
<div className="bg-background border-border/50 absolute inset-0 mx-auto w-80 -translate-x-3 -translate-y-12 rounded-[2rem] border p-2 [mask-image:linear-gradient(to_bottom,#000_50%,transparent_90%)] sm:-translate-x-6">
<div className="relative h-96 overflow-hidden rounded-[1.5rem] border p-2 pb-12 before:absolute before:inset-0 before:bg-[repeating-linear-gradient(-45deg,var(--color-border),var(--color-border)_1px,transparent_1px,transparent_6px)] before:opacity-50"></div>
</div>
<div className="bg-muted dark:bg-background/50 border-border/50 mx-auto w-80 translate-x-4 rounded-[2rem] border p-2 backdrop-blur-3xl [mask-image:linear-gradient(to_bottom,#000_50%,transparent_90%)] sm:translate-x-8">
<div className="bg-background space-y-2 overflow-hidden rounded-[1.5rem] border p-2 shadow-xl dark:bg-white/5 dark:shadow-black dark:backdrop-blur-3xl">
<AppComponent />
<div className="bg-muted rounded-[1rem] p-4 pb-16 dark:bg-white/5"></div>
</div>
</div>
<div className="absolute inset-0 bg-[radial-gradient(#e5e7eb_1px,transparent_1px)] mix-blend-overlay [background-size:16px_16px] [mask-image:radial-gradient(ellipse_50%_50%_at_50%_50%,#000_70%,transparent_100%)] dark:opacity-5"></div>
</div>
</AnimatedGroup>
</div>
</div>
</section>
<LogoCloud />
</main>
</>
)
}
const AppComponent = () => {
return (
<div className="relative space-y-3 rounded-[1rem] bg-white/5 p-4">
<div className="flex items-center gap-1.5 text-orange-400">
<svg
className="size-5"
xmlns="http://www.w3.org/2000/svg"
width="1em"
height="1em"
viewBox="0 0 32 32">
<g fill="none">
<path
fill="#ff6723"
d="M26 19.34c0 6.1-5.05 11.005-11.15 10.641c-6.269-.374-10.56-6.403-9.752-12.705c.489-3.833 2.286-7.12 4.242-9.67c.34-.445.689 3.136 1.038 2.742c.35-.405 3.594-6.019 4.722-7.991a.694.694 0 0 1 1.028-.213C18.394 3.854 26 10.277 26 19.34"></path>
<path
fill="#ffb02e"
d="M23 21.851c0 4.042-3.519 7.291-7.799 7.144c-4.62-.156-7.788-4.384-7.11-8.739C9.07 14.012 15.48 10 15.48 10S23 14.707 23 21.851"></path>
</g>
</svg>
<div className="text-sm font-medium">Steps</div>
</div>
<div className="space-y-3">
<div className="text-foreground border-b border-white/10 pb-3 text-sm font-medium">This year, you're walking more on average than you did in 2023.</div>
<div className="space-y-3">
<div className="space-y-1">
<div className="space-x-1">
<span className="text-foreground align-baseline text-xl font-medium">8,081</span>
<span className="text-muted-foreground text-xs">Steps/day</span>
</div>
<div className="flex h-5 items-center rounded bg-gradient-to-l from-emerald-400 to-indigo-600 px-2 text-xs text-white">2024</div>
</div>
<div className="space-y-1">
<div className="space-x-1">
<span className="text-foreground align-baseline text-xl font-medium">5,412</span>
<span className="text-muted-foreground text-xs">Steps/day</span>
</div>
<div className="text-foreground bg-muted flex h-5 w-2/3 items-center rounded px-2 text-xs dark:bg-white/20">2023</div>
</div>
</div>
</div>
</div>
)
}
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 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.
- Hero Section 707Carousel-driven hero built on Swiper, with a headline and CTA pair.