Search

Search documentation

Menubar

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

Installation

pnpm dlx shadcn@latest add @evolphin/menubar

Usage

import {
  Menubar,
  MenubarContent,
  MenubarItem,
  MenubarMenu,
  MenubarSeparator,
  MenubarShortcut,
  MenubarTrigger,
} from "@/components/ui/menubar";
<Menubar>
  <MenubarMenu>
    <MenubarTrigger>File</MenubarTrigger>
    <MenubarContent>
      <MenubarItem>
        New Tab <MenubarShortcut>⌘T</MenubarShortcut>
      </MenubarItem>
      <MenubarItem>
        New Window <MenubarShortcut>⌘N</MenubarShortcut>
      </MenubarItem>
      <MenubarSeparator />
      <MenubarItem>Share</MenubarItem>
      <MenubarSeparator />
      <MenubarItem>Print</MenubarItem>
    </MenubarContent>
  </MenubarMenu>
</Menubar>

Type Definitions

interface MenubarProps {
  /** The value of the open menu */
  value?: string;
MenubarProps.value?: string | undefined

The value of the open menu

/** The default value of the open menu when uncontrolled */ ?: string; /** Event handler called when the value changes */ ?: (: string) => void; /** Whether to loop through menus */ ?: boolean; }

Examples

Default

API Reference

PropTypeDefaultDescription
valuestring-The value of the open menu.
defaultValuestring-The default value of the open menu when uncontrolled.
onValueChange(value: string) => void-Event handler called when the value changes.
loopbooleanfalseWhether to loop through menus.
PropTypeDefaultDescription
valuestring-The value of the menu.
PropTypeDefaultDescription
classNamestring-Additional CSS classes
PropTypeDefaultDescription
align`"start" \"center" \"end"`
alignOffsetnumber-4The distance in pixels from the trigger.
sideOffsetnumber8The distance in pixels from the trigger.
classNamestring-Additional CSS classes
PropTypeDefaultDescription
disabledbooleanfalseWhether the item is disabled.
onSelect(event: Event) => void-Event handler called when the item is selected.
insetbooleanfalseWhether to indent the item.
PropTypeDefaultDescription
checked`boolean \"indeterminate"`-
onCheckedChange(checked: boolean) => void-Event handler called when the checked state changes.
PropTypeDefaultDescription
valuestring-The value of the selected item.
onValueChange(value: string) => void-Event handler called when the value changes.
PropTypeDefaultDescription
valuestring-The value of the item.
PropTypeDefaultDescription
disabledbooleanfalseWhether the trigger is disabled.
insetbooleanfalseWhether to indent the item.

On this page