Navbar

A site's header, in a header landmark: its brand linking home, a NavigationMenu of links and panels, and calls to action, folded into a sheet on phones.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  {
    label: "Item 1",
    links: [
      {
        label: "Link 1",
        link: "#",
      },
      {
        label: "Link 2",
        link: "#",
      },
      {
        label: "Link 3",
        link: "#",
      },
    ],
  },
  {
    label: "Item 2",
    links: [
      {
        label: "Link 4",
        link: "#",
      },
      {
        label: "Link 5",
        link: "#",
      },
    ],
  },
  { label: "Item 3", link: "#" },
];

const actions: BlockAction[] = [
  { label: "Secondary action", link: "#" },
  { label: "Primary action", link: "#" },
];

const Example = () => (
  <div className="h-80">
    <Navbar
      actions={actions}
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      items={items}
    />
  </div>
);

export default Example;

Usage

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import type { BlockAction } from "@produkto/ui/Section";
const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
];

const actions: BlockAction[] = [
  { label: "Secondary action", link: "#" },
  { label: "Primary action", link: "#" },
];

<Navbar brand="Brand" items={items} actions={actions} />

Examples

Wide panel

The first item opens a wide panel of the catalogue's groups, each under its label, with a featured link at its foot.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  {
    label: "Item 1",
    groups: [
      {
        label: "Group 1",
        links: [
          { label: "Link 1", link: "#" },
          { label: "Link 2", link: "#" },
          { label: "Link 3", link: "#" },
        ],
      },
      {
        label: "Group 2",
        links: [
          { label: "Link 4", link: "#" },
          { label: "Link 5", link: "#" },
          { label: "Link 6", link: "#" },
        ],
      },
      {
        label: "Group 3",
        links: [
          { label: "Link 7", link: "#" },
          { label: "Link 8", link: "#" },
          { label: "Link 9", link: "#" },
        ],
      },
    ],
    footer: {
      label: "Featured link",
      link: "#",
      description: "A short line about the featured item.",
    },
  },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
];

const actions: BlockAction[] = [{ label: "Primary action", link: "#" }];

const Example = () => (
  <div className="h-[28rem]">
    <Navbar actions={actions} brand="Brand" items={items} />
  </div>
);

export default Example;

Icon links

social puts icon-only links in the bar, each named by its label, which also shows as a tooltip.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import {
  GithubIcon,
  Hexagon01Icon,
  NewTwitterIcon,
} from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockSocialLink } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
];

const social: BlockSocialLink[] = [
  { icon: <Icon icon={GithubIcon} />, label: "GitHub", link: "#" },
  { icon: <Icon icon={NewTwitterIcon} />, label: "X", link: "#" },
];

const Example = () => (
  <Navbar
    brand={
      <span className="flex items-center gap-2">
        <Icon icon={Hexagon01Icon} size={22} />
        Brand
      </span>
    }
    items={items}
    social={social}
  />
);

export default Example;

Controls

Its children sit at the end of the bar, ahead of its icon links and actions, at every width: here a DropdownMenu behind an icon Button with a Tooltip.

import { Button } from "@produkto/ui/Button";
import {
  DropdownMenu,
  DropdownMenuContent,
  DropdownMenuItem,
  DropdownMenuTrigger,
} from "@produkto/ui/DropdownMenu";
import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import {
  Tooltip,
  TooltipContent,
  TooltipTrigger,
} from "@produkto/ui/Tooltip";
import { Globe02Icon, Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
];

const actions: BlockAction[] = [{ label: "Button", link: "#" }];

const entries: string[] = ["Item 1", "Item 2", "Item 3"];

const Example = () => (
  <Navbar
    actions={actions}
    align="center"
    brand={
      <span className="flex items-center gap-2">
        <Icon icon={Hexagon01Icon} size={22} />
        Brand
      </span>
    }
    items={items}
  >
    <DropdownMenu>
      <Tooltip>
        <TooltipTrigger asChild>
          <DropdownMenuTrigger asChild>
            <Button aria-label="Language" appearance="transparent" size="sm">
              <Icon icon={Globe02Icon} />
            </Button>
          </DropdownMenuTrigger>
        </TooltipTrigger>
        <TooltipContent>Language</TooltipContent>
      </Tooltip>
      <DropdownMenuContent align="end">
        {entries.map((entry) => (
          <DropdownMenuItem key={entry}>{entry}</DropdownMenuItem>
        ))}
      </DropdownMenuContent>
    </DropdownMenu>
  </Navbar>
);

export default Example;

Links centred

align="center" sets the links in the middle of the bar, between the brand and the actions.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  {
    label: "Item 1",
    links: [
      {
        label: "Link 1",
        link: "#",
      },
      {
        label: "Link 2",
        link: "#",
      },
      {
        label: "Link 3",
        link: "#",
      },
    ],
  },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
];

const actions: BlockAction[] = [
  { label: "Secondary action", link: "#" },
  { label: "Primary action", link: "#" },
];

const Example = () => (
  <div className="h-80">
    <Navbar
      actions={actions}
      align="center"
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      items={items}
    />
  </div>
);

export default Example;

Links right

align="end" gathers the links beside the actions at the end of the bar, for a short name.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
  { label: "Item 4", link: "#" },
];

const actions: BlockAction[] = [{ label: "Primary action", link: "#" }];

const Example = () => (
  <Navbar
    actions={actions}
    align="end"
    brand={
      <span className="flex items-center gap-2">
        <Icon icon={Hexagon01Icon} size={22} />
        Brand
      </span>
    }
    items={items}
  />
);

export default Example;

Name centred

layout="split" sets the brand in the middle, the first half of the links before it and the rest after it, ahead of the actions.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
  { label: "Item 4", link: "#" },
];

const actions: BlockAction[] = [{ label: "Primary action", link: "#" }];

const Example = () => (
  <Navbar actions={actions} layout="split" brand="Brand" items={items} />
);

export default Example;

Floating

floating lifts the bar off the top edge as a rounded panel with a border and a shadow, inset from the sides.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
  { label: "Item 4", link: "#" },
];

const actions: BlockAction[] = [{ label: "Primary action", link: "#" }];

const Example = () => (
  <div className="w-full bg-muted pb-16">
    <Navbar
      actions={actions}
      align="center"
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      floating
      items={items}
    />
  </div>
);

export default Example;

Over the opening

over lays the bar clear over the section under it and gives it its ground once the page scrolls past its top, here with theme="dark" over a dark opening. Scroll the frame.

Eyebrow

Your headline goes here

A short line about what the product does goes here.

import { Hero } from "@produkto/ui/Hero";
import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { ScrollArea } from "@produkto/ui/ScrollArea";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
  { label: "Item 4", link: "#" },
];

const actions: BlockAction[] = [{ label: "Primary action", link: "#" }];

const Example = () => (
  <ScrollArea className="h-96 w-full">
    <Navbar
      actions={actions}
      align="center"
      brand="Brand"
      items={items}
      over
      theme="dark"
    />
    <div data-theme="dark">
      <Hero
        actions={[{ label: "Primary action", link: "#" }]}
        description="A short line about what the product does goes here."
        eyebrow="Eyebrow"
        height="screen"
        title="Your headline goes here"
      />
    </div>
  </ScrollArea>
);

export default Example;

Columns

columns lays a long panel out in a grid of up to five, two across from md, three from lg and five from xl, where the panel is as wide as the bar's row; a panel taller than the window scrolls.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const links = Array.from({ length: 15 }, (_, index) => ({
  label: `Link ${index + 1}`,
  link: "#",
}));

const items: NavbarItem[] = [
  { label: "Item 1", columns: 5, links },
  { label: "Item 2", link: "#" },
];

const Example = () => (
  <div className="h-96">
    <Navbar
      align="center"
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      items={items}
    />
  </div>
);

export default Example;

Columns down

rows sets how many links a column holds at most: the links run down each column in turn and the columns are balanced, twelve links in three columns of four.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const items: NavbarItem[] = [
  {
    label: "Item 1",
    rows: 5,
    links: Array.from({ length: 12 }, (_, at) => ({
      label: `Link ${at + 1}`,
      description: "A line under the name",
      icon: <Icon icon={Hexagon01Icon} />,
      link: "#",
    })),
  },
  { label: "Item 2", link: "#" },
];

const Example = () => (
  <div className="h-96">
    <Navbar
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      items={items}
    />
  </div>
);

export default Example;

Icons

A panel link is a small transparent Button, its icon before its label, as it is in the sheet.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import {
  Hexagon01Icon,
  Layers01Icon,
  Megaphone01Icon,
  ShoppingBag01Icon,
} from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const items: NavbarItem[] = [
  {
    label: "Item 1",
    links: [
      {
        label: "Link 1",
        icon: <Icon icon={Layers01Icon} />,
        link: "#",
      },
      {
        label: "Link 2",
        icon: <Icon icon={ShoppingBag01Icon} />,
        link: "#",
      },
      {
        label: "Link 3",
        icon: <Icon icon={Megaphone01Icon} />,
        link: "#",
      },
    ],
  },
  { label: "Item 2", link: "#" },
];

const Example = () => (
  <div className="h-80">
    <Navbar
      align="center"
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      items={items}
    />
  </div>
);

export default Example;

Muted with a border

muted lays the bar on the muted background, and bordered draws a rule under it.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  { label: "Item 1", link: "#" },
  { label: "Item 2", link: "#" },
  { label: "Item 3", link: "#" },
];

const actions: BlockAction[] = [
  { label: "Secondary action", link: "#" },
  { label: "Primary action", link: "#" },
];

const Example = () => (
  <Navbar
    actions={actions}
    bordered
    brand={
      <span className="flex items-center gap-2">
        <Icon icon={Hexagon01Icon} size={22} />
        Brand
      </span>
    }
    items={items}
    muted
  />
);

export default Example;

Dark

theme="dark" draws the bar in the dark theme whatever the page wears, as over a dark hero, and its panels and menus open dark with it, the language menu here included.

import {
  Navbar,
  type NavbarItem,
  type NavbarProps,
} from "@produkto/ui/Navbar";
import { Globe02Icon, Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";

const items: NavbarItem[] = [
  {
    label: "Item 1",
    links: [
      { label: "First link", link: "#" },
      { label: "Second link", link: "#" },
    ],
  },
  { label: "Item 2", link: "#" },
];

const actions: NavbarProps["actions"] = [
  {
    label: "Language",
    icon: <Icon icon={Globe02Icon} />,
    appearance: "transparent",
    iconOnly: true,
    items: [
      { label: "English", link: "?locale=en" },
      { label: "Français", link: "?locale=fr" },
      { label: "Deutsch", link: "?locale=de" },
    ],
  },
  { label: "Button", link: "#" },
];

const Example = () => (
  <div className="h-80">
    <Navbar
      actions={actions}
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      items={items}
      theme="dark"
    />
  </div>
);

export default Example;

Mobile menu

Shown at the phone breakpoint, below md: a menu button opens a sheet with every link and the actions at the foot, each menu folded behind its label until it is tapped.

import { Navbar, type NavbarItem } from "@produkto/ui/Navbar";
import { Hexagon01Icon } from "@hugeicons/core-free-icons";
import { Icon } from "@produkto/ui/Icon";
import type { BlockAction } from "@produkto/ui/Section";

const items: NavbarItem[] = [
  {
    label: "Item 1",
    links: [
      {
        label: "Link 1",
        link: "#",
      },
      {
        label: "Link 2",
        link: "#",
      },
      {
        label: "Link 3",
        link: "#",
      },
    ],
  },
  {
    label: "Item 2",
    links: [
      {
        label: "Link 4",
        link: "#",
      },
      {
        label: "Link 5",
        link: "#",
      },
    ],
  },
  { label: "Item 3", link: "#" },
];

const actions: BlockAction[] = [
  { label: "Secondary action", link: "#" },
  { label: "Primary action", link: "#" },
];

const Example = () => (
  <div className="h-80">
    <Navbar
      actions={actions}
      brand={
        <span className="flex items-center gap-2">
          <Icon icon={Hexagon01Icon} size={22} />
          Brand
        </span>
      }
      items={items}
    />
  </div>
);

export default Example;

API Reference

Navbar

NavbarProps · blocks/Navbar/Navbar.types.ts
PropTypeDefault
idstring-
brandReactNode-
brandLinkstring"#"
itemsNavbarItem[]-
actions(BlockAction | BlockMenuAction)[]-
socialBlockSocialLink[]-
alignNavbarAlign"start" | "center" | "end""start"
layoutNavbarLayout"row" | "split""row"
widthNavbarWidth"narrow" | "base" | "wide" | "full""base"
stickybooleanfalse
floatingbooleanfalse
overbooleanfalse
mutedbooleanfalse
borderedbooleanfalse
themeThemeMode"light" | "dark"-
classNamestring-
childrenReactNode-

NavbarItem

used by items
PropTypeDefault
iconReactNode-
descriptionstring-
activeboolean-
labelstring-
linkstring-
linksNavbarLink[]-
columnsNavbarColumns1 | 2 | 3 | 4 | 5-
rowsNavbarRows2 | 3 | 4 | 5 | 6-
groupsNavbarGroup[]-
footerNavbarLink-

BlockAction

used by actions
PropTypeDefault
appearanceButtonAppearance"solid" | "soft" | "outline" | "transparent"-
toneButtonTone"neutral" | "accent" | "destructive" | "success" | "warning" | "info"-
iconReactNode-
iconOnlyboolean-
borderRadiusBlockActionBorderRadius"none" | "xs" | "sm" | "base" | "lg" | "xl" | "full"-
labelrequiredstring-
linkrequiredstring-

BlockMenuAction

used by actions
PropTypeDefault
labelrequiredstring-
appearanceButtonAppearance"solid" | "soft" | "outline" | "transparent"-
toneButtonTone"neutral" | "accent" | "destructive" | "success" | "warning" | "info"-
iconReactNode-
iconOnlyboolean-
borderRadiusBlockActionBorderRadius"none" | "xs" | "sm" | "base" | "lg" | "xl" | "full"-
itemsrequiredBlockMenuItem[]-

BlockSocialLink

used by social
PropTypeDefault
iconrequiredReactNode-
labelrequiredstring-
linkrequiredstring-

NavbarLink

used by its parts
PropTypeDefault
iconReactNode-
descriptionstring-
activeboolean-
labelrequiredstring-
linkrequiredstring-

NavbarGroup

used by its parts
PropTypeDefault
labelrequiredstring-
linksrequiredNavbarLink[]-

BlockMenuItem

used by its parts
PropTypeDefault
labelrequiredstring-
iconReactNode-
linkstring-
onSelect() => void-