block

Topbar

A responsive navigation bar block that sticks to the top of the page. Renders a full-width container with support for a logo, desktop navigation links, and a theme mode toggle. On smaller screens, the menu collapses into a slide-up drawer triggered by a menu button.

Default

Provide menuItems for the navigation links and place your logo in the logo slot.

Pindoba

Navigation

---
import Topbar from "../Topbar.astro";
import type { MenuItem } from "@pindoba/astro-navigation";
import { css } from "@pindoba/styled-system/css";

const menuItems: MenuItem[] = [
  { label: "Home", href: "#" },
  { label: "About", href: "#" },
  { label: "Blog", href: "#" },
  { label: "Contact", href: "#" },
];
---

<Topbar menuItems={menuItems}>
  <div
    slot="logo"
    class={css({
      display: "flex",
      alignItems: "center",
      gap: "sm",
      fontSize: "lg",
      fontWeight: "bold",
    })}
  >
    Pindoba
  </div>
</Topbar>

Custom

Use showThemeModeSelect to hide the built-in theme toggle, menuActiveItem to highlight the current page, and passThrough to override styles on individual slots such as container for layout adjustments.

Without Theme Mode Select

MyApp

With Active Menu Item

Pindoba

Navigation

Custom Bottom Border

Pindoba

Navigation

---
import Topbar from "../Topbar.astro";
import type { MenuItem } from "@pindoba/astro-navigation";
import { css } from "@pindoba/styled-system/css";
import { stack } from "@pindoba/styled-system/patterns";

const menuItems: MenuItem[] = [
  { label: "Home", href: "#" },
  { label: "Docs", href: "#" },
  { label: "Examples", href: "#" },
];
---

<div
  class={stack({
    gap: "xl",
    direction: "column",
    width: "100%",
  })}
>
  <!-- Without theme mode select -->
  <div>
    <h3>Without Theme Mode Select</h3>
    <Topbar menuItems={menuItems} showThemeModeSelect={false}>
      <div
        slot="logo"
        class={css({
          fontSize: "lg",
          fontWeight: "bold",
          color: "primary.700",
        })}
      >
        MyApp
      </div>
    </Topbar>
  </div>

  <!-- Active menu item -->
  <div>
    <h3>With Active Menu Item</h3>
    <Topbar menuItems={menuItems} menuActiveItem="Docs">
      <div
        slot="logo"
        class={css({
          fontSize: "lg",
          fontWeight: "bold",
        })}
      >
        Pindoba
      </div>
    </Topbar>
  </div>

  <!-- Custom bottom border via passThrough -->
  <div>
    <h3>Custom Bottom Border</h3>
    <Topbar
      menuItems={menuItems}
      passThrough={{
        root: css.raw({
          backgroundColor: "primary.surface.ground",
        }),
      }}
    >
      <div
        slot="logo"
        class={css({
          fontSize: "lg",
          fontWeight: "bold",
          color: "primary.text.contrast.bold",
        })}
      >
        Pindoba
      </div>
    </Topbar>
  </div>
</div>
props · 14 shown · 14 total
background
string
default "surface.ground"

Surface background forwarded to the Navigation.

desktopThemeModeSelectProps
ThemeModeSelectBaseProps

Props forwarded only to the desktop ThemeModeSelect. Takes precedence over `themeModeSelectProps` for the desktop placement.

extras slot svelte
Snippet

Extra content placed beside the ThemeModeSelect.

id
string

Root element id. Seeds the desktop/mobile ThemeModeSelect ids.

logo slot svelte
Snippet

Brand / logo content.

menu slot svelte
Snippet

Replaces the default Navigation with custom menu content.

menuActiveItem
string

Label of the currently active navigation item — applies the active style.

menuItems
TopbarMenuItem[]

Navigation items rendered by the internal Navigation on both desktop and mobile.

mobileDialogProps
Record<string, unknown>

Props forwarded to the Dialog used as the mobile navigation drawer.

mobileThemeModeSelectProps
ThemeModeSelectBaseProps

Props forwarded only to the mobile ThemeModeSelect (inside the drawer). Takes precedence over `themeModeSelectProps` for the mobile placement.

navigationProps
Record<string, unknown>

Props forwarded to both the desktop and mobile Navigation components.

passThrough
{ [K in TopbarSlots]?: SystemStyleObject }

Per-slot Panda CSS style overrides applied to individual topbar slots.

showThemeModeSelect
boolean
default true

Render the built-in ThemeModeSelect toggle in the desktop and mobile extras area.

themeModeSelectProps
ThemeModeSelectBaseProps

Props forwarded to both ThemeModeSelect instances.

Plus all standard <div> HTML attributes.

Type

  • Components
  • Blocks