block
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.
Provide menuItems for the navigation links and place your logo in the logo slot.
---
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>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.
---
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>"surface.ground"Surface background forwarded to the Navigation.
Props forwarded only to the desktop ThemeModeSelect. Takes precedence over `themeModeSelectProps` for the desktop placement.
Extra content placed beside the ThemeModeSelect.
Root element id. Seeds the desktop/mobile ThemeModeSelect ids.
Brand / logo content.
Replaces the default Navigation with custom menu content.
Label of the currently active navigation item — applies the active style.
Navigation items rendered by the internal Navigation on both desktop and mobile.
Props forwarded to the Dialog used as the mobile navigation drawer.
Props forwarded only to the mobile ThemeModeSelect (inside the drawer). Takes precedence over `themeModeSelectProps` for the mobile placement.
Props forwarded to both the desktop and mobile Navigation components.
Per-slot Panda CSS style overrides applied to individual topbar slots.
trueRender the built-in ThemeModeSelect toggle in the desktop and mobile extras area.
Props forwarded to both ThemeModeSelect instances.
Plus all standard <div> HTML
attributes.