Skip to content
Haze UI

Navbar: simple with mobile menu

Sticky translucent top bar with wordmark, links, optional sign-in and a CTA from lg. Below lg a floating panel menu fades and slides in.

pnpm dlx shadcn@latest add @haze/navbar-simple
Open preview in a new tab
Liveno JavaScript

When to use

  • A marketing site with up to six top-level pages
  • You want a mobile menu that works with zero JavaScript

When not to use

  • You need mega-menu dropdowns with grouped links per item

Installation

Add the Haze registry to components.json once, then install Navbar: simple with mobile menu with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/navbar-simple
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
brandstring"Driftwork"Wordmark text, also used for the home link label.
logoShape"circle" | "square" | "triangle" | "diamond" | "haze""diamond"Glyph shape passed to LogoMark.
links{ label: string; href: string }[]5 demo linksTop-level navigation links.
signInHrefstring"#sign-in"Target of the ghost Sign in button. An empty string hides the button.
signInLabelstring"Sign in"Label of the Sign in button.
ctaLabelstring"Start free"Primary button label.
ctaHrefstring"#start"Primary button target.
menuIdstring"haze-navbar-menu"Id of the mobile popover; must be unique on the page.

Keyboard interactions

EnterSpace
Open or close the mobile menu from the menu button
Esc
Close the mobile menu

Accessibility

  • Wrapped in <header> with <nav aria-label="Main">.
  • The mobile menu uses the native popover API: the toggle button exposes its expanded state and Esc closes the menu without script.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI block "Navbar: simple with mobile menu" with `npx shadcn@latest add @haze/navbar-simple`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import NavbarSimple from "@/components/haze/blocks/navbar-simple.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/blocks/navbar-simple.md

  • Customize with real content

    Adapt the Haze navbar-simple block for our product. Replace the demo values of these props with our real content: brand, logoShape, links, signInHref, signInLabel, ctaLabel, ctaHref, menuId. Keep the layout, the heading level rules and these accessibility details: Wrapped in <header> with <nav aria-label="Main">. The mobile menu uses the native popover API: the toggle button exposes its expanded state and Esc closes the menu without script. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using navbar-simple, check it fits: use it when a marketing site with up to six top-level pages; you want a mobile menu that works with zero javascript. Avoid it when you need mega-menu dropdowns with grouped links per item.

Dependencies

  • npm: @lucide/astro
  • @haze/button
  • @haze/logo-mark
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog