Skip to main content

Menubar

A zero-dependency desktop application menubar with a spring-gliding active trigger pill, spring item highlight inside dropdowns, hover handoff, and WAI-ARIA arrow navigation.

command=ready·profile:linh

Customize

Side offset (px)8
Align offset (px)-4
Motion blur (px)4
Speed1

Installation

npx shadcn@latest add @kinetic/menubar

Usage

Place one MenubarMenu per top-level menu inside Menubar. Each menu pairs a MenubarTrigger with a MenubarContent.

import {
  Menubar,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarSeparator,
  MenubarShortcut,
  MenubarTrigger,
} from "@/components/kinetic/ui/menubar";

export function AppMenubar() {
  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenubarContent>
          <MenubarItem>
            New file <MenubarShortcut>Ctrl+N</MenubarShortcut>
          </MenubarItem>
          <MenubarSeparator />
          <MenubarItem>Close</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
      <MenubarMenu>
        <MenubarTrigger>View</MenubarTrigger>
        <MenubarContent>
          <MenubarItem>Toggle sidebar</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
    </Menubar>
  );
}

Hover handoff

Once a menu is open, moving the pointer onto another trigger switches to that menu, and the active pill glides between triggers.

Items, groups, and labels

MenubarItem supports variant (default or destructive), inset, disabled, closeOnSelect and onSelect. Use MenubarGroup to group related commands and MenubarLabel (with optional inset) to title sections inside MenubarContent.

import {
  MenubarContent,
  MenubarGroup,
  MenubarItem,
  MenubarLabel,
} from "@/components/kinetic/ui/menubar";

<MenubarContent>
  <MenubarGroup>
    <MenubarLabel>Workspace</MenubarLabel>
    <MenubarItem inset>Rename</MenubarItem>
  </MenubarGroup>
  <MenubarItem variant="destructive" onSelect={() => reset()}>
    Reset workspace
  </MenubarItem>
</MenubarContent>

Portal

Wrap MenubarContent in MenubarPortal when composing explicit portals. When container is omitted, MenubarPortal stays a transparent pass-through so the shared morphing dropdown surface keeps gliding across triggers; passing container portals into that DOM element instead.

import { MenubarContent, MenubarMenu, MenubarPortal, MenubarTrigger } from "@/components/kinetic/ui/menubar";

<MenubarMenu value="file">
  <MenubarTrigger>File</MenubarTrigger>
  <MenubarPortal>
    <MenubarContent>...</MenubarContent>
  </MenubarPortal>
</MenubarMenu>

Checkbox and radio items

MenubarCheckboxItem is controlled: pass checked with onCheckedChange. Checkbox and radio items close the menu on select by default; set closeOnSelect={false} to keep it open. Wrap MenubarRadioItem elements, each with a value, in a MenubarRadioGroup.

<MenubarCheckboxItem checked={showRulers} onCheckedChange={setShowRulers}>
  Show rulers
</MenubarCheckboxItem>

<MenubarRadioGroup value={zoom} onValueChange={setZoom}>
  <MenubarRadioItem value="100">100%</MenubarRadioItem>
  <MenubarRadioItem value="200">200%</MenubarRadioItem>
</MenubarRadioGroup>

Nest MenubarSub, MenubarSubTrigger and MenubarSubContent inside a MenubarContent.

<MenubarSub>
  <MenubarSubTrigger>Export</MenubarSubTrigger>
  <MenubarSubContent>
    <MenubarItem>PNG</MenubarItem>
    <MenubarItem>SVG</MenubarItem>
  </MenubarSubContent>
</MenubarSub>

Controlled state

Use value and onValueChange on Menubar to control which menu is open, or defaultValue for an initial menu. Give a MenubarMenu a value to identify it. Use null for no open menu.

const [active, setActive] = useState<string | null>(null);

<Menubar value={active} onValueChange={setActive}>
  <MenubarMenu value="file">...</MenubarMenu>
</Menubar>

Keyboard

Left and Right arrows move between triggers and loop (default true) wraps from the last trigger back to the first. Up and Down arrows open a menu and move through its items.

Motion preferences

Use speed and blurPx on Menubar to tune the pill and dropdown animation; MenubarContent also accepts blurPx. Timing follows the current Kinetic tempo, and motion is simplified when reduced motion is enabled.

API Reference

Menubar

Zero-dependency horizontal application menubar with spring-gliding active pill and keyboard navigation.

PropTypeDefaultDescription
value / defaultValue / onValueChangestring | null / (value: string | null) => void-Controlled or uncontrolled active menu identifier.
loopbooleantrueWraps Left/Right and Up/Down arrow focus between ends.
speednumber1Speed multiplier for trigger pill, dropdown reveal, and row highlight.

MenubarContent / MenubarItem

Portaled dropdown menu panel with spring item highlight and accessible menuitem rows.

PropTypeDefaultDescription
align / alignOffset / sideOffset"start" | "center" | "end" / number / numberalign="start", alignOffset=-4, sideOffset=8Popup alignment and pixel offsets relative to MenubarTrigger.
variant / inset / disabled / onSelect (MenubarItem)"default" | "destructive" / boolean / boolean / () => voidvariant="default"Visual variant, inset padding, disabled state, and activation callback.

MenubarPortal / MenubarGroup / MenubarLabel

Optional portal wrapper (preserving the shared morphing box by default or portaling to a custom container), item group, and section label.

PropTypeDefaultDescription
container (MenubarPortal)Element | null-Optional DOM target; when omitted, MenubarPortal acts as a pass-through preserving the shared morphing surface.
inset (MenubarLabel)booleanfalseIndents the section label to align with items that have leading indicators.

Notes

Place MenubarItem inside MenubarGroup. Reserve Menubar for desktop application toolbars and use NavigationMenu for primary website links.