Skip to content
New

Navbar, simple

beta

The product's name, up to six links and two actions; below a narrow width, the links fold into a sheet.

npx rasengan-ui add navbar-simple
Use it
At the top of a landing page with a handful of sections and one main action.
Avoid it
More than six links, or menus with sub-pages: use the Navigation Menu component.
Built with
ButtonSheet
Pairs with
Hero, centred

Installation

Terminal
npx rasengan-ui add navbar-simple

It installs into components/blocks/navbar-simple/, with what it uses (Button, Sheet) and lib/blocks.ts.

Usage

Without content, the block shows its example. Pass your own, typed by the block's schema, from a content file (here, the example with one field changed):

app/_routes/index.page.tsx
import { NavbarSimple } from "@/components/blocks/navbar-simple";
import { home } from "@/content/home";
 
export default function Home() {
  return <NavbarSimple content={home.navbar} />;
}
content/home.ts
import { example, type NavbarSimpleContent } from "@/components/blocks/navbar-simple";
 
export const home = {
  navbar: {
    ...example,
    brand: { ...example.brand, name: "Your product" },
  } satisfies NavbarSimpleContent,
};

Make it stick to the top with className="sticky top-0 z-40".

Content

FieldTypeLimitsGuidance
brandobject
brand.namestring1–32 charsThe product's name, shown next to the logo, or alone.
brand.hrefstringWhere the name leads: usually '/'.
brand.logooptionalobjectA square mark, about 32px; decorative next to the name, so its alt may be empty.
brand.logo.srcstringA local path ('/images/terrace.jpg') or the project's asset URL.
brand.logo.altstring≤ 140 charsWhat the image shows, for people who cannot see it. Empty only if purely decorative.
brand.logo.widthinteger
brand.logo.heightinteger
linksobject[]1–6 itemsThe page's main sections or pages, in reading order.
links[].labelstring1–24 charsOne or two words: 'Pricing', 'Docs'.
links[].hrefstringA path or an anchor on the page: '/pricing', '#features'.
menuLabelstring1–24 charsThe name of the menu button on narrow screens: 'Menu'.
secondaryoptionalobjectA quiet action before the main one: 'Sign in'.
secondary.labelstring1–32 charsA verb first, two to four words: 'Start free', 'Book a table'.
secondary.hrefstringA path ('/pricing'), an anchor ('#menu'), or a full URL.
primaryobjectThe one action the page is for: 'Start free'.
primary.labelstring1–32 charsA verb first, two to four words: 'Start free', 'Book a table'.
primary.hrefstringA path ('/pricing'), an anchor ('#menu'), or a full URL.

Props

PropNotes
contentNavbarSimpleContent; the example when left out
idthe header's id, for anchor links; "top" by default
classNameon the root element, for spacing

Accessibility

  • A <header> with a <nav> named by the product's name; the menu button is named by menuLabel.
  • Below @3xl the links move into a Sheet: focus goes into it and comes back to the button when it closes.
  • It has no heading, so headingLevel does nothing.