Ballmac UI home

Navbar

A responsive site header that gains a border and shadow on scroll, can hide while scrolling down, and turns its links into a sheet menu on small screens.

Simple pricing for growing teams

Scroll this panel: the header gains a border and a soft shadow once content moves under it.

Starter

Everything you need to ship together, with support when you want it.

Team

Everything you need to ship together, with support when you want it.

Scale

Everything you need to ship together, with support when you want it.

Installation

$ pnpm dlx shadcn@latest add @ballmac/navbar

Usage

import { Navbar, NavbarBrand, NavbarLinks, NavbarLink, NavbarActions, NavbarMobileMenu, NavbarMobileLink } from "@/components/ballmac/navbar"

The full example is in the Code tab above.

Examples

Hides while you scroll down, returns when you scroll up.

Paragraph 1: long pages keep the content in view and bring navigation back on demand.

Paragraph 2: long pages keep the content in view and bring navigation back on demand.

Paragraph 3: long pages keep the content in view and bring navigation back on demand.

Paragraph 4: long pages keep the content in view and bring navigation back on demand.

Paragraph 5: long pages keep the content in view and bring navigation back on demand.

Paragraph 6: long pages keep the content in view and bring navigation back on demand.

Paragraph 7: long pages keep the content in view and bring navigation back on demand.

Paragraph 8: long pages keep the content in view and bring navigation back on demand.

Paragraph 9: long pages keep the content in view and bring navigation back on demand.

Paragraph 10: long pages keep the content in view and bring navigation back on demand.

API reference

<Navbar>

PropTypeDefault
sticky

Stick to the top of the page.

booleantrue
hideOnScroll

Slide out of view while scrolling down and back in while scrolling up. Stays visible while it holds focus.

booleanfalse
border

When to draw the bottom border: `scrolled` only after the page moves, `always`, or `never`.

"scrolled" | "always" | "never""scrolled"
containerClassName

Max width of the content row.

string—
scrollContainer

A scrollable element to watch instead of the page (for a header inside a panel or preview).

ScrollContainer—

<NavbarLinks>

PropTypeDefault
label

Accessible name of the navigation landmark.

string—

<NavbarLink>

PropTypeDefault
active

Marks the link as the current page (`aria-current="page"`).

booleanfalse

<NavbarMobileMenu>

PropTypeDefault
label

Accessible name of the menu button and the panel.

string—

<NavbarMobileLink>

PropTypeDefault
activebooleanfalse

Also accepts the standard attributes of its root element.

Accessibility

KeyAction
TabMoves through brand, links, actions and the menu button
Enter / SpaceOpens the mobile menu; Escape closes it and returns focus
Screen readersLinks are in a labelled navigation landmark; the current page has aria-current

Use with AI

Compose Navbar with NavbarBrand, NavbarLinks/NavbarLink (active sets aria-current), NavbarActions and NavbarMobileMenu with NavbarMobileLink. With the shadcn MCP server set up (guide), ask your agent:

Add the Ballmac UI Navbar (@ballmac/navbar) to this project with the shadcn MCP, then use it where it fits.

Use it for

  • Marketing and docs site headers
  • Headers that should get out of the way on long pages

Not for

  • Application chrome with a sidebar; use app-shell
  • Wide dropdown panels; add mega-menu

Registry JSON: https://ui.ballmac.com/r/navbar.json

Credits

Free to use in personal and commercial projects.