Base astro is a clean template to start a new landing page project, that includes a gradient background and responsive hamburger/dropdown menu 💜🚀
- 🎨 Dynamic Header: Switch between floating and fullscreen header styles
- 📱 Responsive Design: Mobile-first approach with hamburger menu
- 🎯 Multi-level Dropdowns: Support for nested menu items
- 🚀 Astro Framework: Fast, modern static site generation
- 🎨 Atomic Design: Well-structured component architecture
npm create astro@latest -- --template SofiDevO/base-astroThe Header component can switch between two different styles:
---
import Layout from "../layouts/Layout.astro";
---
<!-- Floating header (default) -->
<Layout>
<!-- content -->
</Layout>
<!-- Fullscreen header -->
<Layout headerType="fullscreen">
<!-- content -->
</Layout>
<!-- Direct usage -->
<Header headerType="floating" />
<Header headerType="fullscreen" />| Property | Floating | Fullscreen |
|---|---|---|
| Container Padding | 16px |
0 |
| Max Width | 1100px |
Full width |
| Border Radius | 18px |
0 |
| Header Padding | 0.5rem 1rem |
1rem 2rem |
Configure your navigation menu in /src/components/header/nav-menu/menuItems.data.js:
export const menuItems = [
{ link: "/about", text: "About" },
{ link: "/contact", text: "Contact" },
];export const menuItems = [
{
link: "#",
text: "Services",
submenu: [
{ link: "/web-design", text: "Web Design" },
{ link: "/development", text: "Development" },
{ link: "/consulting", text: "Consulting" },
],
},
];export const menuItems = [
{
link: "#",
text: "Products",
submenu: [
{
link: "#",
text: "Software",
submenu: [
{ link: "/software/web", text: "Web Apps" },
{ link: "/software/mobile", text: "Mobile Apps" },
{ link: "/software/desktop", text: "Desktop Apps" },
],
},
{
link: "#",
text: "Hardware",
submenu: [
{ link: "/hardware/computers", text: "Computers" },
{ link: "/hardware/accessories", text: "Accessories" },
],
},
{ link: "/support", text: "Support" },
],
},
];| Property | Type | Required | Description |
|---|---|---|---|
link |
string | ✅ | URL or anchor for the menu item |
text |
string | ✅ | Display text for the menu item |
submenu |
array | ❌ | Array of nested menu items |
📦src
┣ 📂components
┃ ┣ 📂atoms
┃ ┃ ┣ �anchorButton
┃ ┃ ┣ 📂Button
┃ ┃ ┣ �GradientBg
┃ ┃ ┣ 📂Logo
┃ ┃ ┗ 📂Title
┃ ┗ �header
┃ ┃ ┣ 📂HamburgerButton
┃ ┃ ┗ 📂nav-menu
┃ ┃ ┃ ┣ 📜menuItems.data.js
┃ ┃ ┃ ┣ �NavMenu.astro
┃ ┃ ┃ ┗ 📜MobileNav.astro
┣ 📂data
┃ ┗ 📜siteData.js
┣ 📂layouts
┃ ┣ 📜Layout.astro
┃ ┗ 📜LayoutNoHeader.astro
┣ 📂pages
┃ ┣ 📜index.astro
┃ ┗ 📜404.astro
┗ 📂styles
┃ ┗ 📜global.css
- Clone or create from template
- Install dependencies:
npm install - Start development server:
npm run dev - Configure menu: Edit
/src/components/header/nav-menu/menuItems.data.js - Customize header: Use
headerType="floating"orheaderType="fullscreen"
/- Floating header demo/fullscreen-demo- Fullscreen header demo
All components include proper TypeScript interfaces for better development experience and type safety.