Creates a new submenu item.
Configuration options for the submenu item.
Configuration options for creating a context menu submenu. Extends ContextMenuItemOptions with submenu-specific timing options.
OptionalbuttonClassName?: stringCustom CSS class name for the menu item's <button> element.
OptionalclassName?: stringCustom CSS class name for the menu item's <li> element.
Optionaldisabled?: booleanWhether the menu item is disabled. Defaults to false.
Optionalend?: ContentContent to display after the label.
OptionalhideDelay?: numberDelay in milliseconds before hiding the submenu when mouse leaves. Defaults to 200.
The text label to display.
OptionalshowDelay?: numberDelay in milliseconds before showing the submenu on hover. Defaults to 300.
Optionalstart?: ContentContent to display before the label (e.g., an icon element).
Gets whether the menu item is disabled.
true if the menu item is disabled, false otherwise.
Sets whether the menu item is disabled.
true to disable the menu item, false to enable it.
Gets the label text of the menu item.
The current label text.
Sets the label text of the menu item.
The new label text to display.
Gets the start slot content of the menu item.
The start content (string or HTMLElement), or undefined if not set.
Sets the start slot content of the menu item.
A string (rendered as text) or HTMLElement, or undefined to remove.
Adds a menu item to the submenu.
The menu item to add. Can be a ContextMenuItem or ContextMenuSeparator.
The submenu instance for method chaining.
Removes focus from the menu item, removing the focused styling.
Programmatically triggers a click on the menu item. Only works if the item is not disabled.
This will fire the "click" event with the current context data.
Focuses the menu item, adding the focused styling. Only works if the item is not disabled.
Inserts a menu item into the submenu at the specified index.
The index at which to insert the item. If the index is out of bounds, the item will be added at the end.
The menu item to insert. Can be a ContextMenuItem or ContextMenuSeparator.
The submenu instance for method chaining.
Checks whether there are any registered handlers for the specified event type.
The event type to check.
true if there are registered handlers for the event type, false otherwise.
Removes the menu item from the DOM and cleans up all event listeners and references.
The menu item instance for method chaining.
Removes a menu item from the submenu, doing any clean up necessary.
The menu item to remove.
The submenu instance for method chaining.
A context menu item that displays a submenu when hovered or clicked.
Submenus extend regular menu items and can contain their own menu items, shown in a child menu. They display a chevron icon to indicate that child items are available. Submenus open on hover (with a delay) or on click, and can be navigated using keyboard controls.
Example