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-actionsnpx shadcn@latest add @gnostic/header-justified-nav-actionspnpm dlx shadcn@latest add @gnostic/header-justified-nav-actionsDisclosure bar
Open the navigation links from a compact bar.
bunx --bun shadcn@latest add @gnostic/header-disclosure-barnpx shadcn@latest add @gnostic/header-disclosure-barpnpm dlx shadcn@latest add @gnostic/header-disclosure-barCentered navigation
Balance the navigation with brand details and action links.
bunx --bun shadcn@latest add @gnostic/header-centered-navigationnpx shadcn@latest add @gnostic/header-centered-navigationpnpm dlx shadcn@latest add @gnostic/header-centered-navigationCompact navigation
Keep a short navigation list beside the site actions.
bunx --bun shadcn@latest add @gnostic/header-compact-navigationnpx shadcn@latest add @gnostic/header-compact-navigationpnpm dlx shadcn@latest add @gnostic/header-compact-navigationMedia menu
Add supporting media and descriptions to a navigation panel.
bunx --bun shadcn@latest add @gnostic/header-media-menunpx shadcn@latest add @gnostic/header-media-menupnpm dlx shadcn@latest add @gnostic/header-media-menuMulti column menu
Group related destinations into separate menu columns.
bunx --bun shadcn@latest add @gnostic/header-multi-column-menunpx shadcn@latest add @gnostic/header-multi-column-menupnpm dlx shadcn@latest add @gnostic/header-multi-column-menuExpandable
Expand the compact header to reveal the full navigation.
bunx --bun shadcn@latest add @gnostic/header-expandablenpx shadcn@latest add @gnostic/header-expandablepnpm dlx shadcn@latest add @gnostic/header-expandableProps
HeaderProps
mobileMenu?'sheet' | 'drawer'
Mobile navigation style. - `sheet` - standard sheet menu - `drawer` - used the drawer component to offer swipe gestures and nested menus
'sheet' | 'drawer''sheet'mobileMenuPosition?'right' | 'left'
Screen edge for the mobile menu.
'right' | 'left''right'logoHeaderLogo
Brand mark and home link.
HeaderLogonavigationHeaderNavigationItem[]
Primary site links.
HeaderNavigationItem[]actionsHeaderAction[]
Action links beside the navigation.
HeaderAction[]HeaderLogo
labelstring
Visible brand name beside the logo mark.
stringhrefstring
Destination for the logo link.
stringsrc?LogoImageProps['src']
Logo image. Use one image, or a light and dark pair.
LogoImageProps['src']alt?string
Accessible text for the logo image.
stringlabelHeaderNavigationItem
labelstring
Visible link text.
stringhrefstring
Link destination.
stringdescription?string
Supporting copy for the group.
stringactive?boolean
Mark the current page.
booleanimage?HeaderNavigationImage
Image shown beside the group summary.
HeaderNavigationImagelinks?HeaderNavigationLink[]
Child links for a grouped item.
HeaderNavigationLink[]HeaderNavigationLink
labelstring
Visible link text.
stringhrefstring
Link destination.
stringdescription?string
Supporting copy under the label.
stringicon?string | (SvgComponent & ImageMetadata)
Optional icon - either the icon name or an imported icon component.
string | (SvgComponent & ImageMetadata)active?boolean
Mark the current page.
booleanHeaderNavigationImage
srcImageMetadata
Resolved image asset.
ImageMetadataaltstring
Accessible alternative text.
stringHeaderAction
labelstring
Visible control text.
stringhrefstring
Link destination.
stringicon?string
Optional content icon name.
stringvariant?'default' | 'outline' | 'secondary' | 'ghost'
Action style.
'default' | 'outline' | 'secondary' | 'ghost''default'Action links
bunx --bun shadcn@latest add @gnostic/header-action-linksnpx shadcn@latest add @gnostic/header-action-linkspnpm dlx shadcn@latest add @gnostic/header-action-linksCentered brand mark
Supply your own content. The section uses the selected project preset.
bunx --bun shadcn@latest add @gnostic/header-centered-marknpx shadcn@latest add @gnostic/header-centered-markpnpm dlx shadcn@latest add @gnostic/header-centered-markcontentCenteredMarkHeaderContent
Section content.
CenteredMarkHeaderContentclass?string
Classes added to the root.
stringEditorial header
Use this section for desktop navigation and a mobile menu.
bunx --bun shadcn@latest add @gnostic/header-editorial-menunpx shadcn@latest add @gnostic/header-editorial-menupnpm dlx shadcn@latest add @gnostic/header-editorial-menunamestring
Text wordmark.
stringlogo?BlockImageUrl
Optional monochrome mark, rendered with the text color.
BlockImageUrlhomeHrefstring
Home destination.
stringnavigationBlockLink[]
Primary navigation links.
BlockLink[]actionBlockLink
Main call to action.
BlockLinkclass?string
Classes for the root element.
stringSee serif accent font setup when installing this section.
Pill navigation with an action
bunx --bun shadcn@latest add @gnostic/header-pill-actionnpx shadcn@latest add @gnostic/header-pill-actionpnpm dlx shadcn@latest add @gnostic/header-pill-actionChoose 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.
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.
mobile?Astro content
Adds content to the mobile menu. Use it for an extra link or action.
Astro contentheader-justified-nav-actions
logo-text?Astro content
Sets the text beside the logo image.
Astro contentText from logo.label when suppliedheader-action-links
mark?Astro content
Places a mark before the brand name.
Astro contentheader-centered-mark
logo?Astro content
Sets the logo in both the desktop and mobile header.
Astro contentText from content.nameheader-pill-action
brand?Astro content
Replaces the entire brand link.
Astro contentLink to data.homeHref or / with text from data.name