---
title: Header Blocks for Astro
description: "Astro header and navigation blocks with desktop links and mobile menus. Compare layouts and install editable source with the shadcn CLI."
seo:
    title: "Astro Header blocks: examples and source"
related:
    - /components/navigation-menu
    - /blocks/mobile-menu
    - Header component: /components/header
mode: wide
sidebar:
    label: "Header"
---

Header blocks render their default slot once, in the desktop actions area.
Use `slot="mobile"` for actions that should appear inside the mobile menu.
Navigation items are rendered as real links in both layouts.

Set `mobileMenu="drawer"` to use the [Mobile Menu](/ui/blocks/mobile-menu) drawer
in any header. It includes child links, actions, and the mobile slot.
The default is `mobileMenu="sheet"`. The drawer closes when the viewport reaches
the desktop breakpoint at `1024px`.

```astro
<HeaderJustifiedNavActions {...headerProps} mobileMenu="drawer">
  <a href="/call">Book a call</a>
  <a slot="mobile" href="/call">Book a call</a>
</HeaderJustifiedNavActions>
```

When updating an existing header, move or copy the intended mobile actions
into the named slot. Keep element IDs unique between the two slots.

:::note
On desktop, use the resize handle to adjust the container width and expose the mobile menu.
:::

## Justified Navigation & Actions

Balance the logo, main navigation, and the call to action.

```astro
---
import HeaderJustifiedNavActions from "@/components/blocks/header/header-justified-nav-actions.astro"
import Logo from "@/assets/gnostic-ai-logo.svg"
---

<HeaderJustifiedNavActions
  mobileMenu="drawer"
  logo={{
    label: "gnostic AI",
    href: "https://gnosticai.com",
    src: Logo,
  }}
  navigation={[
    { label: "Services", href: "/blocks/services#image-grid" },
    { label: "Field notes", href: "/blocks/articles#image-grid" },
    { label: "Pilot steps", href: "/blocks/services#process" },
    { label: "Pilot FAQ", href: "/blocks/faqs#split" },
  ]}
  actions={[
    {
      label: "Read the routing test",
      href: "/blocks/article#image-header",
      variant: "ghost",
    },
    {
      label: "View the brief",
      href: "/blocks/contact#editorial-contact",
      variant: "default",
    },
  ]}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/header-justified-nav-actions
```

## Disclosure bar

Open the navigation links from a compact bar.

```astro
---
import Block from "@/components/blocks/header/header-disclosure-bar.astro"

const content = {
  name: "gnostic AI",
  description: "AI consulting and workflow automation.",
  logo: {
    src: "/gnostic-ai-logo.svg",
    alt: "gnostic AI",
  },
  navigation: [
    {
      label: "Services",
      href: "/blocks/services#image-grid",
    },
    {
      label: "Field notes",
      href: "/blocks/articles#image-grid",
    },
  ],
  action: {
    label: "Explore the pilot",
    href: "/blocks/services#process",
  },
  homeHref: "https://gnosticai.com",
}
---

<Block {...content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/header-disclosure-bar
```

## Centered navigation

Balance the navigation with brand details and action links.

```astro
---
import HeaderCenteredNavigation from "@/components/blocks/header/header-centered-navigation.astro"
import Logo from "@/assets/gnostic-ai-logo.svg"
---

<HeaderCenteredNavigation
  mobileMenu="drawer"
  logo={{
    label: "gnostic AI",
    href: "https://gnosticai.com",
    src: Logo,
  }}
  navigation={[
    { label: "Services", href: "/blocks/services#image-grid" },
    { label: "Field notes", href: "/blocks/articles#image-grid" },
    { label: "Pilot steps", href: "/blocks/services#process" },
    { label: "Pilot FAQ", href: "/blocks/faqs#split" },
  ]}
  actions={[
    {
      label: "Read the routing test",
      href: "/blocks/article#image-header",
      variant: "ghost",
    },
    {
      label: "View the brief",
      href: "/blocks/contact#editorial-contact",
      variant: "default",
    },
  ]}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/header-centered-navigation
```

## Compact navigation

Keep a short navigation list beside the site actions.

```astro
---
import HeaderCompactNavigation from "@/components/blocks/header/header-compact-navigation.astro"
import Logo from "@/assets/gnostic-ai-logo.svg"
---

<HeaderCompactNavigation
  mobileMenu="drawer"
  logo={{
    label: "gnostic AI",
    href: "https://gnosticai.com",
    src: Logo,
  }}
  navigation={[
    { label: "Services", href: "/blocks/services#image-grid" },
    { label: "Field notes", href: "/blocks/articles#image-grid" },
    { label: "Pilot FAQ", href: "/blocks/faqs#split" },
  ]}
  actions={[
    {
      label: "Sample inquiry",
      href: "/blocks/contact#split-form",
      icon: "message-square",
      variant: "ghost",
    },
    {
      label: "View the brief",
      href: "/blocks/contact#editorial-contact",
      variant: "default",
    },
  ]}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/header-compact-navigation
```

## Media menu

Add supporting media and descriptions to a navigation panel.

```astro
---
import HeaderMediaMenu from "@/components/blocks/header/header-media-menu.astro"
import Logo from "@/assets/gnostic-ai-logo.svg"
import placeholderImage from "@/assets/placeholder.webp"
---

<HeaderMediaMenu
  mobileMenu="drawer"
  logo={{
    label: "gnostic AI",
    href: "https://gnosticai.com",
    src: Logo,
  }}
  navigation={[
    {
      label: "Services",
      href: "/blocks/services#image-grid",
      description: "Choose a workflow to review and a small test to run.",
      image: {
        src: placeholderImage,
        alt: "Sample image placeholder",
      },
      links: [
        {
          label: "Workflow review",
          href: "/blocks/pricing#comparison",
          description:
            "Compare the scope of a workflow review and a routing pilot.",
          icon: "workflow",
        },
        {
          label: "Ticket routing",
          href: "/blocks/article#image-header",
          description:
            "Check which queue receives each of three sample support requests.",
          icon: "inbox",
        },
        {
          label: "Reply review",
          href: "/blocks/article#centered-header",
          description:
            "Compare a draft reply with the customer’s question and the source policy.",
          icon: "chart-column",
        },
      ],
    },
    {
      label: "Field notes",
      href: "/blocks/articles#image-grid",
      description:
        "Read through sample automation projects and their review steps.",
      links: [
        {
          label: "Invoice checks",
          href: "/blocks/article#editorial-article",
          description:
            "Follow a disputed invoice total from the draft to a reviewer.",
          icon: "book-open",
        },
      ],
    },
    { label: "Pilot steps", href: "/blocks/services#process" },
    { label: "Pilot FAQ", href: "/blocks/faqs#split" },
  ]}
  actions={[
    {
      label: "Compare projects",
      href: "/blocks/pricing#plan-cards",
      variant: "ghost",
    },
    {
      label: "View the brief",
      href: "/blocks/contact#editorial-contact",
      variant: "default",
    },
  ]}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/header-media-menu
```

## Multi column menu

Group related destinations into separate menu columns.

```astro
---
import HeaderMultiColumnMenu from "@/components/blocks/header/header-multi-column-menu.astro"
import Logo from "@/assets/gnostic-ai-logo.svg"
import placeholderImage from "@/assets/placeholder.webp"
---

<HeaderMultiColumnMenu
  mobileMenu="drawer"
  logo={{
    label: "gnostic AI",
    href: "https://gnosticai.com",
    src: Logo,
  }}
  navigation={[
    {
      label: "Services",
      href: "/blocks/services#image-grid",
      description: "Choose a workflow to review and a small test to run.",
      image: {
        src: placeholderImage,
        alt: "Sample image placeholder",
      },
      links: [
        {
          label: "Workflow review",
          href: "/blocks/pricing#comparison",
          description:
            "Compare the scope of a workflow review and a routing pilot.",
          icon: "workflow",
        },
        {
          label: "Ticket routing",
          href: "/blocks/article#image-header",
          description:
            "Check which queue receives each of three sample support requests.",
          icon: "inbox",
        },
        {
          label: "Reply review",
          href: "/blocks/article#centered-header",
          description:
            "Compare a draft reply with the customer’s question and the source policy.",
          icon: "chart-column",
        },
        {
          label: "Pilot handoff",
          href: "/blocks/features#illustrated-timeline",
          description:
            "Give the next owner the routing rule, saved tickets, and manual procedure.",
          icon: "clipboard-check",
        },
      ],
    },
    {
      label: "Field notes",
      href: "/blocks/articles#image-grid",
      description:
        "Read through sample automation projects and their review steps.",
      links: [
        {
          label: "Invoice checks",
          href: "/blocks/article#editorial-article",
          description:
            "Follow a disputed invoice total from the draft to a reviewer.",
          icon: "book-open",
        },
      ],
    },
    { label: "Pilot steps", href: "/blocks/services#process" },
    { label: "Pilot FAQ", href: "/blocks/faqs#split" },
  ]}
  actions={[
    {
      label: "Compare projects",
      href: "/blocks/pricing#plan-cards",
      variant: "ghost",
    },
    {
      label: "View the brief",
      href: "/blocks/contact#editorial-contact",
      variant: "default",
    },
  ]}
/>
```

```sh
bunx --bun shadcn@latest add @gnostic/header-multi-column-menu
```

## Expandable

Expand the compact header to reveal the full navigation.

```astro
---
import HeaderExpandable from "@/components/blocks/header/header-expandable.astro"
import Logo from "@/assets/gnostic-ai-logo.svg"
---

{/*
  The bar is fixed. This box keeps that bar inside the preview.
*/}
<div class="header-expandable-example relative h-96">
  <HeaderExpandable
    logo={{
      label: "gnostic AI",
      href: "https://gnosticai.com",
      src: Logo,
    }}
    navigation={[
      { label: "Services", href: "/blocks/services#image-grid" },
      { label: "Field notes", href: "/blocks/articles#image-grid" },
      { label: "Pilot steps", href: "/blocks/services#process" },
      { label: "Pilot FAQ", href: "/blocks/faqs#split" },
      { label: "Invoice intake", href: "/blocks/article#editorial-article" },
      { label: "Contact", href: "/blocks/contact#split-form" },
    ]}
    description="Explore how gnostic AI tests support routing, invoice intake, and AI-drafted replies."
    actions={[
      {
        label: "View the brief",
        href: "/blocks/contact#editorial-contact",
      },
    ]}
  />
</div>

<style>
  /* Keep the fixed bar inside the preview instead of the docs viewport. */
  .header-expandable-example {
    position: relative;
    height: 640px;
  }
  .header-expandable-example :global([data-expandable-menu]),
  .header-expandable-example :global([data-slot="header-container"]) {
    position: absolute;
  }
  .header-expandable-example :global([data-slot="header-container"]) {
    top: 24px;
  }
</style>
```

```sh
bunx --bun shadcn@latest add @gnostic/header-expandable
```

## Props

### HeaderProps

<AutoTypeTable path="../../packages/ui/src/components/blocks/header/types.ts" name="HeaderProps" />

### HeaderLogo

<AutoTypeTable path="../../packages/ui/src/components/blocks/header/types.ts" name="HeaderLogo" />

### HeaderNavigationItem

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/header/types.ts"
    name="HeaderNavigationItem"
/>

### HeaderNavigationLink

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/header/types.ts"
    name="HeaderNavigationLink"
/>

### HeaderNavigationImage

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/header/types.ts"
    name="HeaderNavigationImage"
/>

### HeaderAction

<AutoTypeTable path="../../packages/ui/src/components/blocks/header/types.ts" name="HeaderAction" />

## Action links

```astro
---
import Block from "@/components/blocks/header/header-action-links.astro"

const content = {
  brand: "gnostic AI",
  contact: {
    label: "View the sample brief",
    href: "/blocks/contact#editorial-contact",
  },
  navigation: [
    {
      label: "Field notes",
      href: "/blocks/articles#image-grid",
    },
    {
      label: "Services",
      href: "/blocks/services#image-grid",
    },
    {
      label: "Pilot FAQ",
      href: "/blocks/faqs#split",
    },
  ],
  homeHref: "https://gnosticai.com",
}
---

<Block {...content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/header-action-links
```

## Centered brand mark

Supply your own content. The section uses the selected project preset.

```astro
---
import Block from "@/components/blocks/header/header-centered-mark/header-centered-mark.astro"
import type { CenteredMarkHeaderContent } from "@/components/blocks/header/header-centered-mark/types"

const content = {
  name: "gnostic AI",
  href: "https://gnosticai.com",
  navigation: [
    {
      label: "Field notes",
      href: "/blocks/articles#image-grid",
    },
    {
      label: "Services",
      href: "/blocks/services#image-grid",
    },
    {
      label: "Pilot FAQ",
      href: "/blocks/faqs#split",
    },
  ],
} satisfies CenteredMarkHeaderContent
---

<div class="relative min-h-80 w-full bg-background">
  <Block {content} />
</div>
```

```sh
bunx --bun shadcn@latest add @gnostic/header-centered-mark
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/header/header-centered-mark/types.ts"
    name="CenteredMarkHeaderProps"
/>

## Editorial header

Use this section for desktop navigation and a mobile menu.

```astro
---
import Section from "@/components/blocks/header/header-editorial-menu/header-editorial-menu.astro"

const section = {
  name: "gnostic AI",
  navigation: [
    {
      label: "Field notes",
      href: "/blocks/articles#image-grid",
    },
    {
      label: "Services",
      href: "/blocks/services#image-grid",
    },
    {
      label: "Pilot FAQ",
      href: "/blocks/faqs#split",
    },
  ],
  action: {
    label: "View the sample brief",
    href: "/blocks/contact#editorial-contact",
  },
  homeHref: "https://gnosticai.com",
}
---

<Section {...section} />
```

```sh
bunx --bun shadcn@latest add @gnostic/header-editorial-menu
```

<AutoTypeTable
    path="../../packages/ui/src/components/blocks/header/header-editorial-menu/types.ts"
    name="HeaderEditorialMenuProps"
/>

See [serif accent font setup](/ui/docs/installation#serif-accent-fonts-for-editorial-blocks) when installing this section.

## Pill navigation with an action

```astro
---
import Block from "@/components/blocks/header/header-pill-action/header-pill-action.astro"

const content = {
  name: "gnostic AI",
  homeHref: "https://gnosticai.com",
  navigation: [
    {
      label: "Field notes",
      href: "/blocks/articles#image-grid",
    },
    {
      label: "Services",
      href: "/blocks/services#image-grid",
    },
    {
      label: "Pilot FAQ",
      href: "/blocks/faqs#split",
    },
  ],
  action: {
    label: "View the sample brief",
    href: "/blocks/contact#editorial-contact",
  },
}
---

<Block {...content} />
```

```sh
bunx --bun shadcn@latest add @gnostic/header-pill-action
```

## Choose a header layout

Choose a header based on logo width, primary links, and the main action. A small site can use direct links; a larger one can use grouped navigation.

## Pass content from Astro

Pass logo, navigation, and actions to the selected block. Some variants support a sheet or drawer mobile menu. Use real hrefs and keep link labels consistent between desktop and mobile views.

## Responsive layout and images

Test the width at which the navigation changes layout with actual labels. Open and close the mobile menu with a keyboard and confirm focus returns to its trigger. Supply separate logo artwork for light and dark mode when the mark needs it.

## Compose the next section

Use [Mobile Menu](/ui/blocks/mobile-menu) for a separate compact navigation composition and [Footer](/ui/blocks/footer) for secondary links.

## Named slots

These slots are optional. Use the slot name on a direct child of the block.

### Mobile navigation

The following headers accept the same slot: `header-compact-navigation`, `header-centered-navigation`, `header-justified-nav-actions`, `header-multi-column-menu`, `header-media-menu`.

| Prop | Type | Default | Description |
| - | - | - | - |
| `mobile?` | `Astro content` | - | Adds content to the mobile menu. Use it for an extra link or action. |

### `header-justified-nav-actions`

| Prop | Type | Default | Description |
| - | - | - | - |
| `logo-text?` | `Astro content` | `Text from logo.label when supplied` | Sets the text beside the logo image. |

### `header-action-links`

| Prop | Type | Default | Description |
| - | - | - | - |
| `mark?` | `Astro content` | - | Places a mark before the brand name. |

### `header-centered-mark`

| Prop | Type | Default | Description |
| - | - | - | - |
| `logo?` | `Astro content` | `Text from content.name` | Sets the logo in both the desktop and mobile header. |

### `header-pill-action`

| Prop | Type | Default | Description |
| - | - | - | - |
| `brand?` | `Astro content` | `Link to data.homeHref or / with text from data.name` | Replaces the entire brand link. |
