Please use Desktop to view and interact with components
Page Transitions500msspring
CTA Banner Section
Animated call-to-action banner with gradient background and button animations
ctabannercall-to-actionbuttonsgradientshadcn
Useto navigate between components
Preview
Ready to Get Started?
Join thousands of developers building amazing interfaces with our animation library. Start today and transform your user experience.
Free Forever
No Credit Card
Open Source
This component requires shadcn/ui
This component uses shadcn/ui components. Make sure you have shadcn/ui set up in your project.
- Install shadcn/ui:
npx shadcn-ui@latest init - Install required components based on the imports in the code (e.g.,
npx shadcn-ui@latest add button) - Ensure your
tailwind.config.tsandglobals.cssare configured as per shadcn/ui documentation
Code
TypeScript + React
'use client'
import { motion } from 'framer-motion'
import { useRef } from 'react'
import { useInView } from 'framer-motion'
import { ArrowRight, Sparkles } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { Card, CardContent } from '@/components/ui/card'
export function CTABannerSection() {
const ref = useRef(null)
const isInView = useInView(ref, { once: true })
const containerVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.2,
delayChildren: 0.1,
},
},
}
const itemVariants = {
hidden: { opacity: 0, y: 30 },
visible: {
opacity: 1,
y: 0,
transition: {
type: 'spring',
stiffness: 100,
damping: 15,
},
},
}
return (
<div ref={ref} className="w-full px-4 py-16">
<div className="mx-auto max-w-4xl">
<motion.div
variants={containerVariants}
initial="hidden"
animate={isInView ? 'visible' : 'hidden'}
>
<Card className="relative overflow-hidden bg-gradient-to-br from-[var(--card-bg)] to-[var(--card-bg)]/80">
<div className="absolute inset-0 bg-gradient-to-r from-accent/5 to-transparent" />
<CardContent className="relative p-8 sm:p-12">
<motion.div variants={itemVariants} className="mb-6 text-center">
<motion.div
initial={{ scale: 0, rotate: -180 }}
animate={isInView ? { scale: 1, rotate: 0 } : { scale: 0, rotate: -180 }}
transition={{ delay: 0.3, type: 'spring' }}
className="mb-4 inline-flex rounded-full bg-accent/10 p-3"
>
<Sparkles className="h-6 w-6 text-accent" />
</motion.div>
<h2 className="mb-4 text-3xl font-bold sm:text-4xl md:text-5xl">
Ready to Get Started?
</h2>
<p className="mx-auto max-w-2xl text-base text-[var(--foreground)]/70 sm:text-lg">
Join thousands of developers building amazing interfaces with our animation library.
Start today and transform your user experience.
</p>
</motion.div>
<motion.div
variants={itemVariants}
className="flex flex-col items-center justify-center gap-4 sm:flex-row"
>
<Button size="lg" className="gap-2">
Get Started
<motion.div
animate={{ x: [0, 4, 0] }}
transition={{ duration: 1.5, repeat: Infinity }}
>
<ArrowRight className="h-4 w-4" />
</motion.div>
</Button>
<Button size="lg" variant="outline">
View Documentation
</Button>
</motion.div>
<motion.div
variants={itemVariants}
className="mt-8 flex flex-wrap items-center justify-center gap-6 text-sm text-[var(--foreground)]/60"
>
<div className="flex items-center gap-2">
<div className="h-2 w-2 rounded-full bg-green-500" />
<span>Free Forever</span>
</div>
<div className="h-4 w-px bg-[var(--border)]" />
<div className="flex items-center gap-2">
<div className="h-2 w-2 rounded-full bg-blue-500" />
<span>No Credit Card</span>
</div>
<div className="h-4 w-px bg-[var(--border)]" />
<div className="flex items-center gap-2">
<div className="h-2 w-2 rounded-full bg-slate-500" />
<span>Open Source</span>
</div>
</motion.div>
</CardContent>
</Card>
</motion.div>
</div>
</div>
)
}
How to Use
- 1Install Framer Motion:
npm install framer-motion - 2Set up shadcn/ui: Install shadcn/ui components used in this code. Check the imports in the code above and install the required components (e.g.,
npx shadcn-ui@latest add button card) - 3Copy the code from above
- 4Paste it into your project and customize as needed
- 5Colors are customizable via Tailwind CSS classes. The default theme uses dark mode colors defined in your globals.css file