Navbar

Keeps the brand, page links and main action at the top of a page, and marks the section you are reading.

Andromeda

Configurations

Supported configurations for this component.

Configurations

3 examples
Default
Andromeda
Without section tracking
Andromeda
With a quiet action
Andromeda

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

PropTypeDefaultDescription
brandreqReact.ReactNode-The brand lockup on the left (a mark and the product name). Shown again at the head of the menu drawer.
links{ label: string, href: string }[]-The page's links, centred. An href starting with '#' scrolls to that section smoothly and is tracked; any other href navigates.
actionsReact.ReactNode-The primary action on the right, kept in the bar at every width. One filled Button.
secondaryActionsReact.ReactNode-Quiet actions before the primary one (a ghost Sign in). Fold into the menu below md.
menuActionsReact.ReactNode-The drawer footer, primary first. Defaults to `actions` then `secondaryActions` as given.
trackSectionsbooleantrueMark the link for the section in view with aria-current="location".
sectionSelectorstring'section'The elements the reading line is tested against. A match without a linked id clears the mark.
stickybooleantrueStick to the top of the scroller, with the hairline shown once the page has moved. False renders a static bar with its hairline always on.
maxWidthstring-The row's max width (a CSS length), to line the bar up with the page's content column. Full width by default.
menuLabelstring'Menu'The drawer's accessible name; the menu buttons read "Open menu" and "Close menu" from it.
onNavigate(href: string) => void-Called instead of the browser's own navigation for links not starting with '#', for a client router.

More Andromeda Pro components