Navbar

The bar across the top of a page. Pure layout: no component library renders this one, and what goes in it is buttons, links and menus.

alpha The class names and states here are stable. The look is not: these styles can change in a minor release, without a major version bump.

ClassDoes what
navbarThe bar: a raised row with the box radius and a hairline round it
navbar-flushEdge to edge across the top of the page: square, a rule under it only, and its contents lined up with the page's side margins (--page-max, --page-pad)
navbar-startLeft group, pushes the rest to the end
navbar-endRight group
menubarA row of menu triggers, for Kobalte's Menubar

Basic

Same markup in both builds
<div class="navbar">
  <div class="navbar-start">
    <strong>Sparkstone</strong>
    <a href="#" class="link">Docs</a>
    <a href="#" class="link">Pricing</a>
  </div>
  <div class="navbar-end">
    <button class="btn btn-ghost">Sign in</button>
    <button class="btn">Start</button>
  </div>
</div>

With a menubar

Kobalte's Menubar is role="menubar", so the row styles itself. Its triggers are divs with no role, so they take .menu-item, and each menu that opens is the same dropdown panel.

<div class="navbar">
  <div class="navbar-start">
    <strong>Editor</strong>
    <div class="menubar">
      <span class="menu-item">File</span>
      <span class="menu-item menu-active">Edit</span>
      <span class="menu-item">View</span>
    </div>
  </div>
</div>
<div class="dropdown-content menu" style="width: 12rem; margin-top: 0.25rem">
  <span class="menu-item">Undo <span class="menu-shortcut">⌘Z</span></span>
  <span class="menu-item">Redo <span class="menu-shortcut">⇧⌘Z</span></span>
</div>

Navigation menu and context menu

Two more Kobalte components reuse what is already here, so they need no classes of their own:

<NavigationMenu class="menubar">
  <NavigationMenu.Menu>
    <NavigationMenu.Trigger class="menu-item">Product</NavigationMenu.Trigger>
    <NavigationMenu.Portal>
      <NavigationMenu.Content class="dropdown-content menu">
        <NavigationMenu.Item class="menu-item">Overview</NavigationMenu.Item>
        <NavigationMenu.Item class="menu-item">Changelog</NavigationMenu.Item>
      </NavigationMenu.Content>
    </NavigationMenu.Portal>
  </NavigationMenu.Menu>
</NavigationMenu>
<ContextMenu>
  <ContextMenu.Trigger class="card">Right-click me</ContextMenu.Trigger>
  <ContextMenu.Portal>
    <ContextMenu.Content>
      <ContextMenu.Item>Rename</ContextMenu.Item>
      <ContextMenu.Item>Delete</ContextMenu.Item>
    </ContextMenu.Content>
  </ContextMenu.Portal>
</ContextMenu>

Composition

Common ways to put this together with other components. The general rules are on Composition.

Site header

A name on the left, links and one call to action on the right.

Same markup in both builds
<header class="navbar">
  <div class="navbar-start">
    <a href="#" class="semantic"><strong>Studio name</strong></a>
  </div>
  <nav class="navbar-end" style="flex-wrap: wrap">
    <a href="#" class="link">Work</a>
    <a href="#" class="link">Writing</a>
    <a href="#" class="link">About</a>
    <a href="#" class="btn">Book a call</a>
  </nav>
</header>

Header with search

An app bar: a name, a search field that takes the spare width, and an account button.

Same markup in both builds
<header class="navbar">
  <strong>App</strong>
  <input class="input" type="search" placeholder="Search" style="flex: 1" />
  <button class="btn btn-ghost">Account</button>
</header>