Skip to content
SENVENLI UI

Navbar

The top bar of a public site: brand, up to five links, actions and a language choice, collapsing into a menu on phones.
A public site's top bar
import {
  Navbar,
  NavbarBrand,
  NavbarItem,
  NavbarActions,
} from "@senvenli/react/navigation";

Examples

Composed from parts

`NavbarBrand`, `NavbarItem` and `NavbarActions` as children: a logo with an icon, a link with a badge.

Compact, with a language switch

The 48px bar with a LanguageSwitcher among the end actions.

Guidelines

When to use it

  • The main navigation of a marketing or public site.

Use something else when

Accessibility

Built in

  • A navigation landmark named "Main menu".
  • The brand link is named for the home page.

You provide

  • A brandLabel when the brand alone does not say where it goes.
  • With children: an id on every NavbarItem (currentKey matches it), or isCurrent on the page's link.

API reference

Navbar

brand
React.ReactNode

The logo and wordmark (the site's logo). It links to brandHref. Or a NavbarBrand child.

brandHref
stringDefault "/"

Where the brand goes: the home page.

brandLabel
string

The brand link's name when the brand alone does not say where it goes ("Acme home").

links
readonly NavbarLink[]

Up to five destinations. Leave it out to compose NavbarItems as children instead.

children
React.ReactNode

With no links: NavbarItems (the destinations), plus an optional NavbarBrand (instead of brand) and NavbarActions (instead of actions).

currentKey
string

The link of the page (or section) in view: marked aria-current="page".

actions
React.ReactNode

At the end: a language switcher, sign-in (subtle), then the one primary action, the same on every page. On phones they move into the menu panel, under the links. Or a NavbarActions child.

isSticky
boolean

Pinned to the top while the page scrolls.

maxWidth
string | number

The width of the bar's content ("1280px", 1280), centred, so the brand and the actions line up with the page's own container; the bar's background and border still run the full width. Left out, the content spans it.

density
DensityDefault "comfortable"

compact: 48px instead of 56px, the bar after the hero.

aria-label
string

Names the navigation landmark; "Main menu" by default.

NavbarBrand

childrenRequired
React.ReactNode

The logo and wordmark; it links to the Navbar's brandHref.

NavbarItem

idRequired
string

Matches the Navbar's currentKey.

hrefRequired
string

A page or an in-page anchor ("/#pricing"); it goes through the host router.

childrenRequired
React.ReactNode

A noun for the place ("Pricing"), never a verb.

isCurrent
boolean

Marks this link as the page in view, instead of the Navbar's currentKey.

NavbarActions

childrenRequired
React.ReactNode

A language switcher, sign-in (subtle), then the one primary action.