Hero Gradient
Full-screen hero with animated gradient background, glassmorphism badge, and CTA group.
herogradientanimatedglassfullscreen
Live Preview
⚡ 200+ Components
Build Beautiful Interfaces
Premium open-source UI components for Astro. Copy, paste, and ship faster.
Usage
Copy and paste this code into your Astro page:
astro
---
import { HeroGradient } from 'astro-component-kit';
---
<HeroGradient /> ---
import { HeroGradient } from 'astro-component-kit';
---
<HeroGradient /> Manual Installation
If you are not using the npm package, create a new file src/components/sections/HeroGradient.astro and paste the following code:
astro
---
// HeroGradient.astro
interface Props {
badge?: string;
title?: string;
subtitle?: string;
}
const {
badge = "⚡ 200+ Components",
title = "Build Beautiful Interfaces",
subtitle = "Premium open-source UI components for Astro.",
} = Astro.props;
---
<section class="hero-gradient">
<div class="hero-gradient__bg" aria-hidden="true"></div>
<div class="hero-gradient__content">
<span class="hero-gradient__badge">{badge}</span>
<h1 class="hero-gradient__title">{title}</h1>
<p class="hero-gradient__subtitle">{subtitle}</p>
<div class="hero-gradient__actions">
<button class="hero-btn hero-btn--primary">Get Started</button>
<button class="hero-btn hero-btn--glass">View on GitHub</button>
</div>
</div>
</section>
<style>
.hero-gradient {
position: relative;
min-height: 80vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: var(--sp-12, 3rem) var(--sp-6, 1.5rem);
background: #030712;
}
.hero-gradient__bg {
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(184,134,11,0.25) 0%, transparent 40%, transparent 60%, rgba(184,134,11,0.15) 100%);
animation: gradientShift 8s ease-in-out infinite alternate;
}
@keyframes gradientShift {
0% { opacity: 0.6; transform: scale(1); }
100% { opacity: 1; transform: scale(1.1); }
}
.hero-gradient__content {
position: relative;
z-index: 1;
text-align: center;
max-width: 750px;
}
.hero-gradient__badge {
display: inline-block;
padding: 0.35rem 0.9rem;
border-radius: 999px;
font-size: 0.78rem;
font-weight: 700;
background: rgba(234,179,8,0.15);
color: #facc15;
border: 1px solid rgba(234,179,8,0.3);
margin-bottom: 1.5rem;
}
.hero-gradient__title {
font-size: clamp(2.5rem, 5vw, 4rem);
font-weight: 900;
color: #fff;
line-height: 1.1;
margin: 0 0 1rem;
}
.hero-gradient__subtitle {
font-size: 1.15rem;
color: #94a3b8;
margin: 0 0 2rem;
}
.hero-gradient__actions {
display: flex;
gap: 1rem;
justify-content: center;
}
.hero-btn {
padding: 0.85rem 1.75rem;
border-radius: 10px;
font-weight: 700;
cursor: pointer;
}
.hero-btn--primary {
background: linear-gradient(135deg, #eab308, #d97706);
color: #000;
border: none;
}
.hero-btn--glass {
background: rgba(255,255,255,0.08);
border: 1px solid rgba(255,255,255,0.15);
color: #fff;
}
</style> ---
// HeroGradient.astro
interface Props {
badge?: string;
title?: string;
subtitle?: string;
}
const {
badge = "⚡ 200+ Components",
title = "Build Beautiful Interfaces",
subtitle = "Premium open-source UI components for Astro.",
} = Astro.props;
---
<section class="hero-gradient">
<div class="hero-gradient__bg" aria-hidden="true"></div>
<div class="hero-gradient__content">
<span class="hero-gradient__badge">{badge}</span>
<h1 class="hero-gradient__title">{title}</h1>
<p class="hero-gradient__subtitle">{subtitle}</p>
<div class="hero-gradient__actions">
<button class="hero-btn hero-btn--primary">Get Started</button>
<button class="hero-btn hero-btn--glass">View on GitHub</button>
</div>
</div>
</section>
<style>
.hero-gradient {
position: relative;
min-height: 80vh;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
padding: var(--sp-12, 3rem) var(--sp-6, 1.5rem);
background: #030712;
}
.hero-gradient__bg {
position: absolute;
inset: 0;
background: linear-gradient(135deg, rgba(184,134,11,0.25) 0%, transparent 40%, transparent 60%, rgba(184,134,11,0.15) 100%);
animation: gradientShift 8s ease-in-out infinite alternate;
}
@keyframes gradientShift {
0% { opacity: 0.6; transform: scale(1); }
100% { opacity: 1; transform: scale(1.1); }
}
.hero-gradient__content {
position: relative;
z-index: 1;
text-align: center;
max-width: 750px;
}
.hero-gradient__badge {
display: inline-block;
padding: 0.35rem 0.9rem;
border-radius: 999px;
font-size: 0.78rem;
font-weight: 700;
background: rgba(234,179,8,0.15);
color: #facc15;
border: 1px solid rgba(234,179,8,0.3);
margin-bottom: 1.5rem;
}
.hero-gradient__title {
font-size: clamp(2.5rem, 5vw, 4rem);
font-weight: 900;
color: #fff;
line-height: 1.1;
margin: 0 0 1rem;
}
.hero-gradient__subtitle {
font-size: 1.15rem;
color: #94a3b8;
margin: 0 0 2rem;
}
.hero-gradient__actions {
display: flex;
gap: 1rem;
justify-content: center;
}
.hero-btn {
padding: 0.85rem 1.75rem;
border-radius: 10px;
font-weight: 700;
cursor: pointer;
}
.hero-btn--primary {
background: linear-gradient(135deg, #eab308, #d97706);
color: #000;
border: none;
}
.hero-btn--glass {
background: rgba(255,255,255,0.08);
border: 1px solid rgba(255,255,255,0.15);
color: #fff;
}
</style>