Creating a Menu
Menu Methods
label
Set the label for the menu.The label text for the menu
add
Add a menu item to the menu.A menu item instance (Label, Link, Checkbox, Radio, or Separator)
Returns the Menu instance for method chaining
register
Register the menu with the application.Menu Item Types
Label
A standard clickable menu item.The text label for the menu item
Optional keyboard shortcut (e.g., “CmdOrCtrl+Q”)
Link
A menu item that navigates to a URL.The URL to navigate to
The text label for the menu item
Optional keyboard shortcut
openInBrowser
Set whether the link should open in the system browser.Whether to open in browser
Checkbox
A menu item with a checkbox.The text label for the menu item
Whether the checkbox is initially checked
Optional keyboard shortcut
Radio
A menu item with a radio button.The text label for the menu item
Whether the radio button is initially selected
Optional keyboard shortcut
Separator
A visual separator between menu items.Common Menu Item Methods
All menu item types support the following methods:id
Set a unique identifier for the menu item.The unique identifier
label
Set the label text.The label text
sublabel
Set a secondary label text.The sublabel text
icon
Set an icon for the menu item.Path to the icon file
accelerator
Set a keyboard shortcut.Keyboard shortcut (e.g., “CmdOrCtrl+Q”)
hotkey
Alias foraccelerator().
Keyboard shortcut (e.g., “CmdOrCtrl+Q”)
tooltip
Set a tooltip for the menu item.The tooltip text
enabled
Enable the menu item.disabled
Disable the menu item.visible
Set the visibility of the menu item.Whether the menu item is visible
checked
Set the checked state (for Checkbox and Radio items).Whether the item is checked
event
Set a Laravel event to dispatch when the menu item is clicked.The event class name
submenu
Add a submenu to the menu item.Variable number of menu items