Dashral Pro is hereSee pricing

Dashral

MenubarNew

The row of menus along the top of an app: File, Edit, View.

$ pnpm dlx shadcn@latest add @dashral/menubar

Installation

$ pnpm dlx shadcn@latest add @dashral/menubar

Adds the component, the components it builds on, its npm packages and the theme tokens it uses. Or by its full URL: https://dashral.com/r/menubar.json

Usage

example.tsx
import { Menubar } from "@/components/dashral/menubar"

<Menubar
  menus={[
    { label: "File", items: [{ label: "New", shortcut: "⌘N", onSelect: createDocument }, { label: "Open…", shortcut: "⌘O" }] },
    { label: "Edit", items: [{ label: "Undo", shortcut: "⌘Z" }, { label: "Redo", shortcut: "⇧⌘Z" }] },
  ]}
/>

Using the npm package? Import from @dashral/ui/components/menubar instead, here and in the examples; the rest is the same.

API reference

Menubar

Also takes every prop of Radix Menubar(opens in a new tab).

PropTypeDefault
menus{ label, items: MenuItem[], disabled?, className? }[]

The menus, in order. items take the same MenuItem as Dropdown Menu. Required.

—
linkAsElementType

Your router's link, for items with href.

"a"
value / onValueChangestring

The open menu, controlled.

—
classNamestring

Extra classes, merged with cn() so yours win.

—

Keyboard

KeysAction
←or→Move between menus on the bar, or open the next one while one is open
EnterorSpaceor↓Open the focused menu
↓or↑Move between items
EnterorSpaceChoose the item (toggle a checkbox or radio item)
→Open a submenu
←Close a submenu
EscapeClose the menu and return focus
A–ZJump to the item starting with that letter

Accessibility

  • role="menubar" with menus of role="menu"; one menu tab stop on the bar, the arrows move along it.

Motion

  • Opens with a fade, a scale from 95%, a 2px blur clearing and a 4px slide from its trigger's side, on the spring (--duration-standard); closes faster (--duration-fast, --ease-exit). No blur with reduced motion.