Navbar

Sticky top navigation bar with backdrop blur

The Navbar component provides a responsive sticky navigation bar that sits at the top of the viewport. It includes backdrop blur for a modern glass effect and adapts to mobile screens.

Installation

bash
shellui add navbar

Basic Usage

<Navbar>
  <a href="/" class="text-lg font-bold">MyApp</a>
  <nav class="ml-auto flex items-center gap-6 text-sm font-medium">
    <a href="/docs" class="text-muted-foreground transition-colors hover:text-foreground">Docs</a>
    <a href="/about" class="text-muted-foreground transition-colors hover:text-foreground">About</a>
    <ThemeToggle />
  </nav>
</Navbar>

With Mobile Menu

Combine with a Drawer for responsive mobile navigation:

<Navbar>
  <div class="flex items-center gap-4">
    <Button Variant="ButtonVariant.Ghost" Size="ButtonSize.Icon"
            Class="md:hidden" OnClick="() => mobileMenuOpen = true">
      <svg class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
        <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
      </svg>
    </Button>
    <a href="/" class="font-bold">MyApp</a>
    <nav class="hidden items-center gap-6 text-sm font-medium md:flex">
      <a href="/docs" class="text-muted-foreground transition-colors hover:text-foreground">Docs</a>
      <a href="/pricing" class="text-muted-foreground transition-colors hover:text-foreground">Pricing</a>
    </nav>
  </div>
  <div class="ml-auto flex items-center gap-2">
    <ThemeToggle />
    <Button Size="ButtonSize.Sm">Sign Up</Button>
  </div>
</Navbar>

<Drawer @bind-Open="mobileMenuOpen"
        Side="DrawerSide.Left" Title="Navigation">
  <nav class="grid gap-2 py-4">
    <a href="/docs" class="block py-2 text-lg">Documentation</a>
    <a href="/pricing" class="block py-2 text-lg">Pricing</a>
    <a href="/about" class="block py-2 text-lg">About</a>
  </nav>
</Drawer>

@code {
    private bool mobileMenuOpen = false;
}

API Reference

Property Type Default Description
ChildContent RenderFragment null Navbar content (logo, links, actions)
ClassName string? null Additional CSS classes

Default Styling

The Navbar renders as a sticky top bar with:

  • position: sticky; top: 0; z-index: 50
  • Backdrop blur (backdrop-blur-lg)
  • Border bottom
  • Responsive padding

Accessibility

The Navbar component includes:

  • Semantic header and nav elements
  • Keyboard navigable links
  • Skip-to-content link support
  • Mobile menu toggle with aria-expanded
  • Proper landmark roles for screen readers

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.