Reddot UI Library

Docs
Menubar

Menubar

A visually persistent menu common in desktop applications that provides quick access to a consistent set of commands.

Installation

$npx shadcn@latest add https://reddot.dottools.xyz/r/menubar.json

Utilisation

import {
  Menubar,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarSeparator,
  MenubarShortcut,
  MenubarTrigger,
} from "@/components/ui/menubar"
 
export function MenubarDemo() {
  return (
    <Menubar>
      <MenubarMenu>
        <MenubarTrigger>File</MenubarTrigger>
        <MenubarContent>
          <MenubarItem>
            New Tab <MenubarShortcut>⌘T</MenubarShortcut>
          </MenubarItem>
          <MenubarItem>New Window</MenubarItem>
          <MenubarSeparator />
          <MenubarItem>Share</MenubarItem>
          <MenubarSeparator />
          <MenubarItem>Print</MenubarItem>
        </MenubarContent>
      </MenubarMenu>
    </Menubar>
  )
}

API Reference

Contains all the parts of a menubar.

PropTypeDefaultDescription
defaultValuestring-The value of the menu that should be open when initially rendered. Use when you do not need to control the state of the menubar.
valuestring-The controlled value of the menu to open. Should be used in conjunction with onValueChange.
onValueChange(value: string) => void-Event handler called when the value changes.
dir"ltr" | "rtl"-The reading direction of the menubar when applicable.
loopbooleantrueWhen true, keyboard navigation will loop from last tab to first, and vice versa.

A top level menu item, contains a trigger with content combination.

The button that toggles the menu. By default, the MenubarContent will position itself against the trigger.

The component that pops out when the menu is open.

PropTypeDefaultDescription
side"top" | "right" | "bottom" | "left""bottom"The preferred side of the anchor to render against when open.
sideOffsetnumber0The distance in pixels from the anchor.
align"start" | "center" | "end""start"The preferred alignment against the anchor.
alignOffsetnumber0An offset in pixels from the "start" or "end" alignment options.
loopbooleanfalseWhen true, keyboard navigation will loop from last item to first, and vice versa.

The component that contains the menubar items.

PropTypeDefaultDescription
disabledbooleanfalseWhen true, prevents the user from interacting with the item.
onSelect(event: Event) => void-Event handler called when the user selects an item (via mouse or keyboard).
textValuestring-Optional text used for typeahead purposes.

Used to visually separate items in the menubar.

A styled component for displaying keyboard shortcuts.

Références