Footer
A comprehensive footer component designed for documentation sites and landing pages. Includes support for navigation sections, social links, newsletter signup, and multiple layout variants to match your site’s design.
Features
- Multiple Variants: Default, minimal, and detailed layouts
- Navigation Sections: Organized link groups with titles
- Social Media Integration: Customizable social links with icons
- Newsletter Signup: Optional email subscription form
- Responsive Design: Adapts to all screen sizes
- Customizable: Easy to style and extend
Basic Usage
import Footer from "@/components/block/Footer.astro"
<Footer
companyName="Your Company"
description="Building the future of documentation with modern tools."
sections={[
{
title: "Product",
links: [
{ title: "Features", href: "javascript:void(null);" },
{ title: "Pricing", href: "javascript:void(null);" },
{ title: "Documentation", href: "javascript:void(null);" }
]
},
{
title: "Company",
links: [
{ title: "About", href: "javascript:void(null);" },
{ title: "Blog", href: "javascript:void(null);" },
{ title: "Careers", href: "javascript:void(null);" }
]
}
]}
socialLinks={[
{
name: "Twitter",
href: "javascript:void(null);",
icon: `<svg>...</svg>`
}
]}
/>
Examples
Default Footer
Detailed Footer with Newsletter
Props
Prop | Type | Default | Description |
---|---|---|---|
logo | string | undefined | Logo image URL |
logoAlt | string | '' | Alt text for logo |
companyName | string | 'Your Company' | Company name |
description | string | Default description | Company description |
sections | FooterSection[] | [] | Navigation sections |
socialLinks | SocialLink[] | [] | Social media links |
copyright | string | Auto-generated | Custom copyright text |
showNewsletter | boolean | false | Show newsletter signup |
newsletterTitle | string | 'Stay updated' | Newsletter section title |
newsletterDescription | string | Default text | Newsletter description |
variant | 'default' | 'minimal' | 'detailed' | 'default' | Footer layout variant |
className | string | '' | Additional CSS classes |
Data Types
FooterSection
interface FooterSection {
title: string;
links: Link[];
}
Link
interface Link {
title: string;
href: string;
external?: boolean;
}
SocialLink
interface SocialLink {
name: string;
href: string;
icon: string; // SVG markup as string
}
Variants
Default Variant
Standard footer with company info and navigation sections side by side.
<Footer variant="default" companyName="Your Company" sections={sections} />
Minimal Variant
Simple footer with just copyright and social links.
<Footer variant="minimal" companyName="Your Company" />
Detailed Variant
Comprehensive footer with company info, navigation, and newsletter signup in separate columns.
<Footer
variant="detailed"
companyName="Your Company"
sections={sections}
showNewsletter={true}
/>
Customization
Custom Copyright
<Footer
copyright="© 2024 Your Company. Made with ❤️ by our team."
companyName="Your Company"
/>
External Links
Mark links as external to add proper attributes:
const sections = [
{
title: "Resources",
links: [
{ title: "GitHub", href: "javascript:void(null);", external: true },
{ title: "Status Page", href: "javascript:void(null);", external: true }
]
}
];
Custom Content
Use the slot for additional footer content:
<Footer companyName="Your Company">
<div class="custom-footer-content">
<p>Additional footer information</p>
<a href="javascript:void(null);" class="cta-link">Terms of Service</a>
</div>
</Footer>
Social Icons
Common social media icons you can use:
GitHub
<svg width="20" height="20" fill="currentColor" viewBox="0 0 24 24">
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
</svg>
<svg width="20" height="20" fill="currentColor" viewBox="0 0 24 24">
<path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/>
</svg>
Responsive Behavior
- Desktop: Full layout with all sections displayed
- Tablet: Adjusted grid layout with proper spacing
- Mobile: Stacked layout with centered content
- Newsletter: Form stacks vertically on mobile
Accessibility
- Proper semantic HTML structure
- External links include
rel="noopener noreferrer"
- Social links have proper
aria-label
attributes - Keyboard navigation support
- High contrast color support
Best Practices
- Keep It Organized: Group related links in logical sections
- Limit Sections: 3-4 sections work best for readability
- Social Icons: Use consistent icon sizes and styles
- Copyright: Keep copyright text concise and up-to-date
- External Links: Always mark external links appropriately