- No data uploaded
- Instant results
Bootstrap 5 Hero Section for React — Glassmorphism
A production-ready glassmorphism hero section: a landing-page hero with an announcement badge, a large headline, supporting copy, primary and secondary calls to action and a row of social-proof stats. Pick your brand color, toggle dark mode and corner radius — the live preview and the React code update instantly in your browser.
Live component editor
import 'bootstrap/dist/css/bootstrap.min.css';
import './theme.css';
export default function HeroSection() {
return (
<section className="px-4 py-5">
<div className="mw-4xl mx-auto text-center">
<span className="badge rounded-pill bg-brand-subtle text-brand">New · v2.0 is live</span>
<h1 className="mt-4 fs-2 fw-bolder lh-sm text-body-emphasis">Ship beautiful interfaces in minutes, not weeks</h1>
<p className="mt-4 fs-5 lh-lg text-body-secondary">Production-ready components with accessible markup, dark mode and your brand color — copy, paste and ship.</p>
<div className="mt-5 d-flex flex-wrap align-items-center justify-content-center gap-2">
<a href="#" className="btn btn-brand fw-semibold rounded-2">Start building free</a>
<a href="#" className="btn btn-outline-secondary fw-semibold rounded-2">View components</a>
</div>
<div className="mt-5 d-flex flex-wrap justify-content-center gap-5">
<div>
<p className="fs-4 fw-bold text-body-emphasis">12k+</p>
<p className="small text-body-secondary">teams</p>
</div>
<div>
<p className="fs-4 fw-bold text-body-emphasis">99.99%</p>
<p className="small text-body-secondary">uptime</p>
</div>
<div>
<p className="fs-4 fw-bold text-body-emphasis">4.9/5</p>
<p className="small text-body-secondary">rating</p>
</div>
</div>
</div>
</section>
);
}
/* theme.css — brand color #4f46e5 for Bootstrap 5.3 */
:root { --brand: #4f46e5; --brand-hover: #433cc3; --brand-rgb: 79, 70, 229; --brand-contrast: #ffffff; }
.btn-brand {
--bs-btn-color: var(--brand-contrast); --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
--bs-btn-hover-color: var(--brand-contrast); --bs-btn-hover-bg: var(--brand-hover); --bs-btn-hover-border-color: var(--brand-hover);
--bs-btn-active-color: var(--brand-contrast); --bs-btn-active-bg: var(--brand-hover); --bs-btn-active-border-color: var(--brand-hover);
--bs-btn-focus-shadow-rgb: var(--brand-rgb);
}
.text-brand { color: var(--brand) !important; }
.border-brand { border: 2px solid var(--brand) !important; }
.bg-brand-subtle { background-color: rgba(var(--brand-rgb), .12) !important; }
.form-control:focus, .form-check-input:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(var(--brand-rgb), .25); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.overlay { background: rgba(15, 23, 42, .5); backdrop-filter: blur(4px); z-index: 1050; }
.choice[aria-pressed="true"] { border-color: var(--brand) !important; color: var(--brand) !important; box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .2); }
.mw-sm { max-width: 24rem; } .mw-md { max-width: 28rem; } .mw-lg { max-width: 32rem; } .mw-xl { max-width: 36rem; }
.mw-2xl { max-width: 42rem; } .mw-4xl { max-width: 56rem; } .mw-6xl { max-width: 72rem; }
.glass { background: rgba(255, 255, 255, .6) !important; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); border: 1px solid rgba(255, 255, 255, .6) !important; }
[data-bs-theme="dark"] .glass, [data-bs-theme="dark"].glass { background: rgba(255, 255, 255, .05) !important; border-color: rgba(255, 255, 255, .1) !important; }
.bg-glass-page { background: linear-gradient(135deg, #e0e7ff, #f0f9ff, #ffe4e6); }
[data-bs-theme="dark"] .bg-glass-page, [data-bs-theme="dark"].bg-glass-page { background: linear-gradient(135deg, #020617, #1e1b4b, #0f172a); }
More Bootstrap components for React
All components →- Feature Grid A marketing section with a centered heading and a responsive grid of six feature cards, each with an icon badge, title and description
- Testimonial Slider A customer testimonial carousel that shows one quote at a time with labelled slide buttons — no autoplay, so users stay in control
- Navbar A responsive top navigation bar with a logo, primary links, a sign-in/CTA pair on desktop and a collapsible hamburger menu on mobile
- Pricing Table A three-tier pricing section with a monthly/yearly billing toggle, a highlighted “most popular” plan and feature checklists
- Signup Form A registration card with name, email and password fields, a password hint, a terms-of-service checkbox and a primary call to action
- Login Modal A centered sign-in dialog with email and password fields, “remember me”, a forgot-password link and a social sign-in button
- Contact Form A contact card with name, email, a topic selector, a message textarea and a submit button
- Footer A multi-column site footer with a brand description, three link groups, a newsletter sign-up field and a copyright row
Install Bootstrap 5 for React
Create a React project with Vite and install Bootstrap:
npm create vite@latest my-app -- --template react
cd my-app
npm install
npm install bootstrapSave the generated theme.css next to the component; the component file already imports bootstrap/dist/css/bootstrap.min.css and ./theme.css. No Bootstrap JavaScript is required — interactivity uses useState.
Use the hero section in React
// App.jsx
import HeroSection from './HeroSection';
export default function App() {
return <HeroSection />;
}Accessibility & customization
The headline is the page’s single <h1>, CTAs are links with descriptive text, and stats use a definition-list-like structure readable in order by screen readers.
Every color, radius and dark-mode choice is baked into plain Bootstrap classes plus a tiny CSS-variable theme file, so the copied code has no runtime dependency on this site. The glass style relies on backdrop-filter, supported in all current browsers; place it over a colorful background for the best effect.
Compatibility
| Item | Details |
|---|---|
| CSS framework | Bootstrap 5.3+ (CSS only) |
| Library | React 18+ (function component) |
| Interactive state | None (static markup) |
| Dark mode | Yes — toggle in the editor |
| Style | Glassmorphism (backdrop blur) |