Skip to content
Esc
↑↓navigate↵open⌘Jpreview

Header Blocks for Astro

Astro header and navigation blocks with desktop links and mobile menus. Compare layouts and install editable source with the shadcn CLI.

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 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.

<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.

Justified Navigation & Actions

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

bunx --bun shadcn@latest add @gnostic/header-justified-nav-actions
npx shadcn@latest add @gnostic/header-justified-nav-actions
pnpm dlx shadcn@latest add @gnostic/header-justified-nav-actions

Centered navigation

Balance the navigation with brand details and action links.

bunx --bun shadcn@latest add @gnostic/header-centered-navigation
npx shadcn@latest add @gnostic/header-centered-navigation
pnpm dlx shadcn@latest add @gnostic/header-centered-navigation

Compact navigation

Keep a short navigation list beside the site actions.

bunx --bun shadcn@latest add @gnostic/header-compact-navigation
npx shadcn@latest add @gnostic/header-compact-navigation
pnpm dlx shadcn@latest add @gnostic/header-compact-navigation

Media menu

Add supporting media and descriptions to a navigation panel.

bunx --bun shadcn@latest add @gnostic/header-media-menu
npx shadcn@latest add @gnostic/header-media-menu
pnpm dlx shadcn@latest add @gnostic/header-media-menu

Multi column menu

Group related destinations into separate menu columns.

bunx --bun shadcn@latest add @gnostic/header-multi-column-menu
npx shadcn@latest add @gnostic/header-multi-column-menu
pnpm dlx shadcn@latest add @gnostic/header-multi-column-menu

Expandable

Expand the compact header to reveal the full navigation.

bunx --bun shadcn@latest add @gnostic/header-expandable
npx shadcn@latest add @gnostic/header-expandable
pnpm dlx shadcn@latest add @gnostic/header-expandable

Props

HeaderProps

PropType
mobileMenu?'sheet' | 'drawer'

Mobile navigation style. - `sheet` - standard sheet menu - `drawer` - used the drawer component to offer swipe gestures and nested menus

Type'sheet' | 'drawer'
Default'sheet'
mobileMenuPosition?'right' | 'left'

Screen edge for the mobile menu.

Type'right' | 'left'
Default'right'
logoHeaderLogo

Brand mark and home link.

TypeHeaderLogo
navigationHeaderNavigationItem[]

Primary site links.

TypeHeaderNavigationItem[]
actionsHeaderAction[]

Action links beside the navigation.

TypeHeaderAction[]
PropType
labelstring

Visible brand name beside the logo mark.

Typestring
hrefstring

Destination for the logo link.

Typestring
src?LogoImageProps['src']

Logo image. Use one image, or a light and dark pair.

TypeLogoImageProps['src']
alt?string

Accessible text for the logo image.

Typestring
Defaultlabel

HeaderNavigationItem

PropType
labelstring

Visible link text.

Typestring
hrefstring

Link destination.

Typestring
description?string

Supporting copy for the group.

Typestring
active?boolean

Mark the current page.

Typeboolean
image?HeaderNavigationImage

Image shown beside the group summary.

TypeHeaderNavigationImage
links?HeaderNavigationLink[]

Child links for a grouped item.

TypeHeaderNavigationLink[]
PropType
labelstring

Visible link text.

Typestring
hrefstring

Link destination.

Typestring
description?string

Supporting copy under the label.

Typestring
icon?string | (SvgComponent & ImageMetadata)

Optional icon - either the icon name or an imported icon component.

Typestring | (SvgComponent & ImageMetadata)
active?boolean

Mark the current page.

Typeboolean

HeaderNavigationImage

PropType
srcImageMetadata

Resolved image asset.

TypeImageMetadata
altstring

Accessible alternative text.

Typestring

HeaderAction

PropType
labelstring

Visible control text.

Typestring
hrefstring

Link destination.

Typestring
icon?string

Optional content icon name.

Typestring
variant?'default' | 'outline' | 'secondary' | 'ghost'

Action style.

Type'default' | 'outline' | 'secondary' | 'ghost'
Default'default'

Header Portfolio

An independent section from the Portfolio template. Supply its content through props.

bunx --bun shadcn@latest add @gnostic/header-portfolio
npx shadcn@latest add @gnostic/header-portfolio
pnpm dlx shadcn@latest add @gnostic/header-portfolio

Centered brand mark

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

bunx --bun shadcn@latest add @gnostic/header-centered-mark
npx shadcn@latest add @gnostic/header-centered-mark
pnpm dlx shadcn@latest add @gnostic/header-centered-mark
PropType
contentCenteredMarkHeaderContent

Section content.

TypeCenteredMarkHeaderContent
class?string

Classes added to the root.

Typestring

Editorial header

Use this section for desktop navigation and a mobile menu.

bunx --bun shadcn@latest add @gnostic/header-agency
npx shadcn@latest add @gnostic/header-agency
pnpm dlx shadcn@latest add @gnostic/header-agency
PropType
namestring

Text wordmark.

Typestring
logo?AgencyImage

Optional monochrome mark, rendered with the text color.

TypeAgencyImage
homeHrefstring

Home destination.

Typestring
navigationAgencyLink[]

Primary navigation links.

TypeAgencyLink[]
actionAgencyLink

Main call to action.

TypeAgencyLink
class?string

Classes for the root element.

Typestring

See serif accent font setup when installing this section.

Home services header

bunx --bun shadcn@latest add @gnostic/header-remodify
npx shadcn@latest add @gnostic/header-remodify
pnpm dlx shadcn@latest add @gnostic/header-remodify

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 for a separate compact navigation composition and Footer for secondary links.