Skip to content
Esc
↑↓navigate↵open⌘Jpreview
On this page

Header for Astro

Astro header parts for a site logo, navigation, and actions.

Usage

import { Button } from "@/components/ui/button"
import { Header, HeaderContainer, HeaderGroup } from "@/components/ui/header"
import { Logo, LogoText } from "@/components/ui/logo"

Examples

Installation

bunx --bun shadcn@latest add @gnostic/header

Notes

  • Header controls the layout — default is full-width, floating is a constrained rounded card.
  • HeaderGroup is an unopinionated flex row. Use utility classes like ml-auto or justify-end on the group when you need alignment.
  • HeaderContainer is an optional middle slot when you need a flex region between left and right groups.
  • For a mobile menu, use Sheet and SheetTrigger from @/components/ui/sheet directly inside a HeaderGroup.

API Reference

Read the installed source for the complete prop types.

When to use Header

Use Header as the page-level header container, then add the logo, navigation, and actions through its parts. The default and floating variants change the shell; they do not choose navigation links for you.

Keyboard and behavior

Keep a clear navigation landmark and label icon controls. A compact header still needs a working route to all primary links. Add a mobile menu composition when the full navigation does not fit.

Theme and layout

Check the logo width, long link labels, and action spacing at narrow widths. Floating surfaces need enough contrast over the page beneath them. Sticky positioning is a page layout choice.