Menubar

Navigation

Horizontal menu bar with dropdown triggers.

Preview

Usage

example.jsx
import { Menubar, MenubarTrigger } from "@/components/ui/menubar";

export default function Example() {
  return <Menubar />;
}

Source Code

Copy this file into components/ui/menubar.jsx in your project.

menubar.jsx
"use client";

import { forwardRef } from "react";
import { cn } from "@/lib/utils";

const Menubar = forwardRef(({ className, ...props }, ref) => (
  <div ref={ref} className={cn("flex h-10 items-center space-x-1 rounded-md border bg-background p-1", className)} {...props} />
));
Menubar.displayName = "Menubar";

const MenubarTrigger = forwardRef(({ className, ...props }, ref) => (
  <button ref={ref} className={cn("flex cursor-pointer select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none hover:bg-accent hover:text-accent-foreground", className)} {...props} />
));
MenubarTrigger.displayName = "MenubarTrigger";

export { Menubar, MenubarTrigger };

Quick Install

Make sure you have the cn() utility set up. It requires clsx and tailwind-merge.

npm install clsx tailwind-merge