Skip to content

PageHeader

The PageHeader component provides a consistent header section for content pages with a title and optional description.

  • Type: Layout Component
  • Category: Page Structure
  • Complexity: Simple
  • File: src/components/PageHeader.astro
  • Consistent Styling - Uniform appearance across all pages
  • Optional Description - Subtitle or introductory text
  • Optional Background - Can include background image or color
  • Responsive Typography - Scales appropriately on mobile/desktop
interface Props {
title: string;
description?: string;
backgroundImage?: ImageMetadata;
}
PropTypeDefaultDescription
titlestringRequiredMain page heading (H1)
descriptionstringundefinedOptional subtitle or description
backgroundImageImageMetadataundefinedOptional background image
---
import PageHeader from '@/components/PageHeader.astro';
---
<PageHeader title="About Us" />
  • Title: 3xl on mobile, 4xl on desktop
  • Description: Large text, gray color
  • Font Weight: Bold for title, normal for description
  • Centered text alignment
  • Maximum width container
  • Padding for comfortable spacing
  • Responsive margin bottom

When backgroundImage is provided:

  • Full-width image with overlay
  • Text appears in white
  • Darker overlay for readability
  1. Standard Pages

    <PageHeader
    title="Membership"
    description="Join FiNAN and connect with Filipino nurses across the Nordics"
    />
  2. Simple Headers

    <PageHeader title="FAQ" />
  3. Visual Headers

    <PageHeader
    title="Our Impact"
    description="Making a difference in Nordic healthcare"
    backgroundImage={impactImage}
    />
  • Heading Hierarchy: Uses proper <h1> tag for title
  • Semantic Structure: Description in <p> tag
  • Alt Text: Background images should have meaningful alt attributes
  • Color Contrast: Ensures text is readable against backgrounds
  • Keep title concise (3-7 words)
  • Use description for SEO-relevant context
  • Match title to page’s <title> meta tag
  • Avoid duplicate H1 elements on the same page

While PageHeader is simple, consider these alternatives:

  • HeroHeader - For homepage with larger imagery and CTAs
  • EventHeaderSection - For event pages with date/location
  • Plain <h1> - For pages that don’t need a full header section
  • astro:assets (if using background images)
  • About Us
  • Membership
  • Contact
  • FAQ
  • Privacy Policy
  • Most static content pages

View the complete implementation:

https://github.com/poncardasm/finan-website/blob/main/src/components/PageHeader.astro