Skip to content
All blocks

[02] Marketing

Navbar

A logo, page links, a sign-in link and a call to action, with the links moving into a menu below 1024px.

1280px

Copy the code

One file with one component and its sample data. It needs @vaneui/ui and its stylesheet, set up as in the installation guide.

navbar.tsx

import { Button, Container, Divider, IconButton, Menu, MenuItem, NavLink, Row, Section, Text } from "@vaneui/ui";
const links = [
{ href: "/product", label: "Product" },
{ href: "/customers", label: "Customers" },
{ href: "/pricing", label: "Pricing" },
{ href: "/docs", label: "Docs" },
];
function LogoMark() {
return (
<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<path d="M12 2.5 22 20.5H2z" />
</svg>
);
}
function MenuIcon() {
return (
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true">
<path d="M4 6h16M4 12h16M4 18h16" />
</svg>
);
}
export function Navbar({ current = "/product" }: { current?: string }) {
return (
<Section tag="header" sm borderB>
<Container itemsStretch>
<Row justifyBetween>
<Row xl>
<Row href="/" xs>
<LogoMark />
<Text fontBold>Acme</Text>
</Row>
<Row tag="nav" aria-label="Main" noGap tabletHide>
{links.map((l) => (
<NavLink key={l.href} href={l.href} active={l.href === current} wFit>{l.label}</NavLink>
))}
</Row>
</Row>
<Row sm>
<Button href="/signin" ghost secondary tabletHide>Sign in</Button>
<Button href="/signup" filled>Start free</Button>
<Menu trigger={<IconButton tabletShow ghost secondary aria-label="Open navigation"><MenuIcon /></IconButton>}>
{links.map((l) => (
<MenuItem key={l.href} href={l.href} aria-current={l.href === current ? "page" : undefined}>{l.label}</MenuItem>
))}
<Divider />
<MenuItem href="/signin">Sign in</MenuItem>
</Menu>
</Row>
</Row>
</Container>
</Section>
);
}

How it adapts

  • 1024px and up: the logo and four links on the left, Sign in and Start free on the right.
  • Below 1024px: the links and Sign in move into a menu button beside Start free.
  • The link of the current page is highlighted, and its menu item carries aria-current.

How these props work is in responsive page sections without breakpoint classes.

Adapt it with your coding agent

Add the VaneUI MCP server, and your agent reads the component docs and prop tables while it changes the block: the copy, the sample data or the layout.

$ claude mcp add vaneui -- npx -y @vaneui/mcp

Setup for other editors is in the AI assistants guide.