Menu — Smart UI React API
On this page + Quick start
Quick start · React
Complete starter source per framework. Run the scaffold/install command first, then replace the listed files with the full code below.
// src/main.tsx
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);// src/App.tsx
import { useEffect, useRef } from 'react';
import 'smart-webcomponents/source/styles/smart.default.css';
import { Menu } from 'smart-webcomponents-react/menu';
export default function App() {
const ref = useRef<Menu | null>(null);
useEffect(() => {
const el = ref.current as any;
if (!el) return;
el.mode = 'horizontal';
el.selectionMode = 'click';
el.dataSource = [
{ label: 'File', items: [{ label: 'New', shortcut: 'Ctrl+N' }, { label: 'Open', shortcut: 'Ctrl+O' }, { label: 'Save', shortcut: 'Ctrl+S' }] },
{ label: 'Edit', items: [{ label: 'Undo', shortcut: 'Ctrl+Z' }, { label: 'Redo', shortcut: 'Ctrl+Y' }] },
{ label: 'Help', items: [{ label: 'Docs' }, { label: 'About' }] }
];
el.addEventListener('change', (event: any) => console.log('change:', event.detail ?? event));
}, []);
return <Menu ref={ref} id="demo-menu" />;
}
For AI tooling
Developer Quick Reference
Component: Menu Framework: React Selector: smart-menu
API counts: 32 properties, 13 methods, 10 events
Common properties: 0, 1, 2, 3, 4, 5
Common methods: addItem(), checkItem(), clear(), clickItem(), close(), collapseItem()
Common events: close, closing, collapse, collapsing, expand, expanding
Module hint: smart-webcomponents-react/menu
Horizontal, Vertical and Popup Menu. Popup Menus appear when a user taps an interactive UI element such as an icon, button, action, or content, such as selected items or text.
Component
Menu
Horizontal, Vertical and Popup Menu. Popup Menus appear when a user taps an interactive UI element such as an icon, button, action, or content, such as selected items or text.
Selector
<Menu>
Quick picks
Properties
mouseenter event. This allows keyboard interactions or focus styles to activate without requiring a manual click or tab action from the user.smart-menu-item or smart-menu-items-group). Use this property to enable or disable the display of selectable options directly in the Menu. For further customization of individual items, refer to the checkable property.Events
Methods
Properties
animationSets or retrieves the current animation mode. When this property is set to 'none', all animations are disabled and the element remains static. Otherwise, animations will be enabled according to the specified mode."none" | "simple" | "advanced"
Sets or retrieves the current animation mode. When this property is set to 'none', all animations are disabled and the element remains static. Otherwise, animations will be enabled according to the specified mode.
Allowed Values
- "none" - animation is disabled
- "simple" - ripple animation is disabled
- "advanced" - all animations are enabled
Default value
"advanced"Examples
Markup and runtime examples for animation:
JSX:
<Menu animation="none" />
Imperative (ref from createRef / useRef):
menuRef.current!.animation = "simple";
Read the current value:
const animation = menuRef.current!.animation;
autoCloseDelaySpecifies the delay, in milliseconds, before the Menu dropdown is closed after the mouse cursor leaves the Menu area. This setting is only effective when the selectionMode property is set to 'mouseenter'. Adjusting this value can help prevent the dropdown from closing too quickly when the mouse briefly leaves the Menu.number
Specifies the delay, in milliseconds, before the Menu dropdown is closed after the mouse cursor leaves the Menu area. This setting is only effective when the selectionMode property is set to 'mouseenter'. Adjusting this value can help prevent the dropdown from closing too quickly when the mouse briefly leaves the Menu.
Default value
100Examples
Markup and runtime examples for autoCloseDelay:
JSX:
<Menu autoCloseDelay={1000} />Imperative (ref from createRef / useRef):
menuRef.current!.autoCloseDelay = 200;
Read the current value:
const autoCloseDelay = menuRef.current!.autoCloseDelay;
autoFocusOnMouseenterIf set to true, the element will automatically receive focus when the user's mouse pointer enters (hovers over) it, triggering a mouseenter event. This allows keyboard interactions or focus styles to activate without requiring a manual click or tab action from the user.boolean
If set to true, the element will automatically receive focus when the user's mouse pointer enters (hovers over) it, triggering a mouseenter event. This allows keyboard interactions or focus styles to activate without requiring a manual click or tab action from the user.
Default value
falseExamples
Markup and runtime examples for autoFocusOnMouseenter:
JSX — boolean prop:
<Menu autoFocusOnMouseenter={true} />Imperative (ref from createRef / useRef):
menuRef.current!.autoFocusOnMouseenter = false;
Read the current value:
const autoFocusOnMouseenter = menuRef.current!.autoFocusOnMouseenter;
checkableEnables checkboxes for top-level menu items (the direct children of the main Menu component), allowing users to select or deselect these items. To make submenu items (nested within menu groups) checkable, set the checkable property individually on the corresponding smart-menu-items-group elements. This allows for granular control over which menu levels support checkable states.boolean
Enables checkboxes for top-level menu items (the direct children of the main Menu component), allowing users to select or deselect these items. To make submenu items (nested within menu groups) checkable, set the checkable property individually on the corresponding smart-menu-items-group elements. This allows for granular control over which menu levels support checkable states.
Default value
falseExamples
Markup and runtime examples for checkable:
JSX — boolean prop:
<Menu checkable={true} />Imperative (ref from createRef / useRef):
menuRef.current!.checkable = false;
Read the current value:
const checkable = menuRef.current!.checkable;
checkboxesControls whether checkboxes and radio buttons can be shown within the Menu component. This property applies exclusively to the main Menu, not to its subitems (i.e., smart-menu-item or smart-menu-items-group). Use this property to enable or disable the display of selectable options directly in the Menu. For further customization of individual items, refer to the checkable property.boolean
Controls whether checkboxes and radio buttons can be shown within the Menu component. This property applies exclusively to the main Menu, not to its subitems (i.e., smart-menu-item or smart-menu-items-group). Use this property to enable or disable the display of selectable options directly in the Menu.
For further customization of individual items, refer to the checkable property.
Default value
falseExamples
Markup and runtime examples for checkboxes:
JSX — boolean prop:
<Menu checkboxes={true} />Imperative (ref from createRef / useRef):
menuRef.current!.checkboxes = false;
Read the current value:
const checkboxes = menuRef.current!.checkboxes;
checkModeSets the selection mode (check mode) for the top-level Menu items, which are the immediate children of the Menu component. The 'checkMode' property determines how these menu items can be toggled or selected:- Possible values for 'checkMode' are: - ''checkbox'': Menu items can be checked and unchecked independently (multiple selections allowed). - ''radioButton'': Menu items are mutually exclusive (only one can be selected at a time, like radio buttons). - ''none'': Menu items have no checkable or selectable state.You can also assign a comma-separated list of these values (for example, ''checkbox, radioButton, none, checkbox''). If a list is provided, each value corresponds to a group of top-level menu items. These groups are separated by menu separators (special items acting as visual dividers). The first value in the list applies to the first group of menu items, the second value to the next group (after the first separator), and so on. When a separator is encountered, it signals the start of a new checkMode context, applying the next value in the list to subsequent items.Note: This 'checkMode' property only affects the top-level menu items. To control check modes for submenus or nested groups, set the 'checkMode' property individually on each smart-menu-items-group (the group component representing submenu levels)."checkbox" | "radioButton"
Sets the selection mode (check mode) for the top-level Menu items, which are the immediate children of the Menu component. The 'checkMode' property determines how these menu items can be toggled or selected:
- Possible values for 'checkMode' are:
- ''checkbox'': Menu items can be checked and unchecked independently (multiple selections allowed).
- ''radioButton'': Menu items are mutually exclusive (only one can be selected at a time, like radio buttons).
- ''none'': Menu items have no checkable or selectable state.
You can also assign a comma-separated list of these values (for example, ''checkbox, radioButton, none, checkbox''). If a list is provided, each value corresponds to a group of top-level menu items. These groups are separated by menu separators (special items acting as visual dividers). The first value in the list applies to the first group of menu items, the second value to the next group (after the first separator), and so on. When a separator is encountered, it signals the start of a new checkMode context, applying the next value in the list to subsequent items.
Note: This 'checkMode' property only affects the top-level menu items. To control check modes for submenus or nested groups, set the 'checkMode' property individually on each smart-menu-items-group (the group component representing submenu levels).
Allowed Values
- "checkbox" - A check box is shown inside a menu item that is selected.
- "radioButton" - A radio dot is shown inside a menu item that is selected.
Default value
"checkbox"Examples
Markup and runtime examples for checkMode:
JSX:
<Menu checkMode="radioButton" />
Imperative (ref from createRef / useRef):
menuRef.current!.checkMode = "checkbox";
Read the current value:
const checkMode = menuRef.current!.checkMode;
closeActionDefines the document-level event that triggers the closure of all open menu dropdowns, or the entire menu if the mode property is set to 'dropDown'. This event ensures that any active menu or submenu is properly closed when the specified user interaction occurs (e.g., clicking outside the menu)."down" | "up" | "none"
Defines the document-level event that triggers the closure of all open menu dropdowns, or the entire menu if the mode property is set to 'dropDown'. This event ensures that any active menu or submenu is properly closed when the specified user interaction occurs (e.g., clicking outside the menu).
Allowed Values
- "down" - Closes the drop down on document down event.
- "up" - Closes the drop down on document up event.
- "none" - The drop down can be closed only from the menu.
Default value
"up"Examples
Markup and runtime examples for closeAction:
JSX:
<Menu closeAction="down" />
Imperative (ref from createRef / useRef):
menuRef.current!.closeAction = "none";
Read the current value:
const closeAction = menuRef.current!.closeAction;
dataSourceSpecifies the data source for the Menu component. The data source should be provided as an array of objects, where each object represents a menu item with the following properties:- 'label': *(string, required)* — The text displayed for the menu item.- 'value': *(any, required)* — The unique value associated with the menu item, used for identification or selection.- 'shortcut': *(string, optional)* — A keyboard shortcut hint displayed alongside the menu item, helping users discover quick access keys.- 'items': *(array, optional)* — An array of objects representing sub-menu items, allowing for nested menus and hierarchical structures. Each sub-menu item follows the same structure as a top-level menu item.By configuring the data source in this format, you enable dynamic and flexible rendering of complex menu structures.{label: string, shortcut: string, value: any, items:[]}[]
Specifies the data source for the Menu component. The data source should be provided as an array of objects, where each object represents a menu item with the following properties:
- 'label': *(string, required)* — The text displayed for the menu item.
- 'value': *(any, required)* — The unique value associated with the menu item, used for identification or selection.
- 'shortcut': *(string, optional)* — A keyboard shortcut hint displayed alongside the menu item, helping users discover quick access keys.
- 'items': *(array, optional)* — An array of objects representing sub-menu items, allowing for nested menus and hierarchical structures. Each sub-menu item follows the same structure as a top-level menu item.
By configuring the data source in this format, you enable dynamic and flexible rendering of complex menu structures.
Examples
Markup and runtime examples for dataSource:
JSX:
<Menu dataSource="[{ label: "File" }, { label: "Help" }]" />Imperative (ref from createRef / useRef):
menuRef.current!.dataSource = [{ label: 'File', items: [{ label: 'New', shortcut: 'Ctrl+N' }] }];Read the current value:
const dataSource = menuRef.current!.dataSource;
disabledControls whether the element is active and interactive (enabled) or inactive and non-interactive (disabled). When disabled, users cannot interact with the element.boolean
Controls whether the element is active and interactive (enabled) or inactive and non-interactive (disabled). When disabled, users cannot interact with the element.
Default value
falseExamples
Markup and runtime examples for disabled:
JSX — boolean prop:
<Menu disabled={true} />Imperative (ref from createRef / useRef):
menuRef.current!.disabled = false;
Read the current value:
const disabled = menuRef.current!.disabled;
displayMemberSpecifies which field in the data source should be used as the item's label. This determines the text value displayed for each item in the UI by mapping it to the corresponding property from your data.string
Specifies which field in the data source should be used as the item's label. This determines the text value displayed for each item in the UI by mapping it to the corresponding property from your data.
Default value
"label"Examples
Markup and runtime examples for displayMember:
JSX:
<Menu displayMember="title" />
Imperative (ref from createRef / useRef):
menuRef.current!.displayMember = "caption";
Read the current value:
const displayMember = menuRef.current!.displayMember;
dropDownAnchorWhen this property is set and the Menu is in drop-down mode, the Menu's position will be anchored to the ID set by this property.string
When this property is set and the Menu is in drop-down mode, the Menu's position will be anchored to the ID set by this property.
Default value
""Examples
Markup and runtime examples for dropDownAnchor:
JSX:
<Menu dropDownAnchor="#button" />
Imperative (ref from createRef / useRef):
menuRef.current!.dropDownAnchor = "#otherButton";
Read the current value:
const dropDownAnchor = menuRef.current!.dropDownAnchor;
dropDownAppendToHere is a revised and enhanced version of your description:Specifies a custom outer container to which all dropdown containers will be appended. By default, dropdown elements are appended inside the menu itself. You can assign this property an HTML element directly, or provide the id of an existing HTML element (as a string).When the menu is in mode 'dropDown', the dropDownAppendTo property not only determines where the dropdowns are appended, but also controls the parent container of the entire menu. Note that the open method will open the menu relative to its original position within the DOM, regardless of the value of dropDownAppendTo.Use this property to customize the DOM structure, for example, to ensure that dropdowns are rendered within a specific container for layout, styling, or layering purposes.string | HTMLElement
Here is a revised and enhanced version of your description:
Specifies a custom outer container to which all dropdown containers will be appended. By default, dropdown elements are appended inside the menu itself. You can assign this property an HTML element directly, or provide the id of an existing HTML element (as a string).
When the menu is in mode 'dropDown', the dropDownAppendTo property not only determines where the dropdowns are appended, but also controls the parent container of the entire menu. Note that the open method will open the menu relative to its original position within the DOM, regardless of the value of dropDownAppendTo.
Use this property to customize the DOM structure, for example, to ensure that dropdowns are rendered within a specific container for layout, styling, or layering purposes.
Examples
Markup and runtime examples for dropDownAppendTo:
JSX:
<Menu dropDownAppendTo="body" />
Imperative (ref from createRef / useRef):
menuRef.current!.dropDownAppendTo = "'customContainer'";
Read the current value:
const dropDownAppendTo = menuRef.current!.dropDownAppendTo;
dropDownOverlayWhen this property is enabled, opening an element’s dropdown will display a transparent overlay that covers the area between the dropdown and the rest of the page. This overlay prevents interaction with other page elements while the dropdown is open, helping to focus the user’s attention on the dropdown content.boolean
When this property is enabled, opening an element’s dropdown will display a transparent overlay that covers the area between the dropdown and the rest of the page. This overlay prevents interaction with other page elements while the dropdown is open, helping to focus the user’s attention on the dropdown content.
Default value
falseExamples
Markup and runtime examples for dropDownOverlay:
JSX — boolean prop:
<Menu dropDownOverlay={true} />Imperative (ref from createRef / useRef):
menuRef.current!.dropDownOverlay = false;
Read the current value:
const dropDownOverlay = menuRef.current!.dropDownOverlay;
dropDownPositionSpecifies the direction in which the menu dropdown will appear when opened (e.g., above, below, left, or right relative to the triggering element), allowing customization of dropdown placement to enhance user interface layout and usability."auto" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "overlay-left" | "overlay-right"
Specifies the direction in which the menu dropdown will appear when opened (e.g., above, below, left, or right relative to the triggering element), allowing customization of dropdown placement to enhance user interface layout and usability.
Allowed Values
- "auto" - The position is automatically determined by measuring the available distance around the element for the drop down to open freely without being clipped by the edges of the browser. By default the drop down will try to open below the element. If the available space is not enough for the popup to appear it will open in one of the following directions, if possible: top, over.
- "top-left" - The drop down opens above and to the left of the seleted Item Group.
- "top-right" - The drop down opens above and to the right of the seleted Item Group.
- "bottom-left" - The drop down opens below and to the left of the seleted Item Group.
- "bottom-right" - The drop down opens below and to the right of the seleted Item Group.
- "overlay-left" - The drop down opens over the seleted Item Group by aligning to the left.
- "overlay-right" - The drop down opens over and to the left of the seleted Item Group by aligning to the right.
Default value
"auto"Examples
Markup and runtime examples for dropDownPosition:
JSX:
<Menu dropDownPosition="top-left" />
Imperative (ref from createRef / useRef):
menuRef.current!.dropDownPosition = "top-right";
Read the current value:
const dropDownPosition = menuRef.current!.dropDownPosition;
itemsA getter method that retrieves and returns an array containing all current Menu item objects, allowing access to the complete list of menu entries managed by the application.array
A getter method that retrieves and returns an array containing all current Menu item objects, allowing access to the complete list of menu entries managed by the application.
Default value
itemsMemberSpecifies the field name in the data source that contains the collection of subitems associated with each item group. This property allows the component to identify and retrieve subitems for each group by referencing the appropriate data field.string
Specifies the field name in the data source that contains the collection of subitems associated with each item group. This property allows the component to identify and retrieve subitems for each group by referencing the appropriate data field.
Default value
"items"Examples
Markup and runtime examples for itemsMember:
JSX:
<Menu itemsMember="children" />
Imperative (ref from createRef / useRef):
menuRef.current!.itemsMember = "subitems";
Read the current value:
const itemsMember = menuRef.current!.itemsMember;
localeSpecifies or retrieves the current language setting for the component. This property determines which language is used when displaying text from the messages property, allowing for dynamic localization and internationalization of the user interface. When the language is changed, the corresponding localized messages are retrieved from the messages object.string
Specifies or retrieves the current language setting for the component. This property determines which language is used when displaying text from the messages property, allowing for dynamic localization and internationalization of the user interface. When the language is changed, the corresponding localized messages are retrieved from the messages object.
Default value
"en"Examples
Markup and runtime examples for locale:
JSX:
<Menu locale="de" />
Imperative (ref from createRef / useRef):
menuRef.current!.locale = "en";
Read the current value:
const locale = menuRef.current!.locale;
localizeFormatFunctionA callback function that allows you to customize the formatting of messages returned by the Localization Module. Use this to modify how localized strings are generated or displayed, such as adjusting placeholders, applying additional formatting, or handling special localization rules before the message is returned.function | null
A callback function that allows you to customize the formatting of messages returned by the Localization Module. Use this to modify how localized strings are generated or displayed, such as adjusting placeholders, applying additional formatting, or handling special localization rules before the message is returned.
Examples
Markup and runtime examples for localizeFormatFunction:
JSX:
<Menu localizeFormatFunction="function(defaultMessage, message, messageArguments){return '...'}" />Imperative (ref from createRef / useRef):
menuRef.current!.localizeFormatFunction = "function(defaultMessage, message, messageArguments){return '...'}";Read the current value:
const localizeFormatFunction = menuRef.current!.localizeFormatFunction;
messagesSpecifies or retrieves an object containing the set of strings used within the widget interface that can be localized for different languages. This property works together with the locale property to enable internationalization by allowing developers to customize or translate UI text according to the user's language preferences.object
Specifies or retrieves an object containing the set of strings used within the widget interface that can be localized for different languages. This property works together with the locale property to enable internationalization by allowing developers to customize or translate UI text according to the user's language preferences.
Default value
"en": {
"propertyUnknownType": "'{{name}}' property is with undefined 'type' member!",
"propertyInvalidValue": "Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!",
"propertyInvalidValueType": "Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!",
"elementNotInDOM": "Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.",
"moduleUndefined": "Module is undefined.",
"missingReference": "{{elementType}}: Missing reference to {{files}}.",
"htmlTemplateNotSuported": "{{elementType}}: Browser doesn't support HTMLTemplate elements.",
"invalidTemplate": "{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."
}
Examples
Markup and runtime examples for messages:
JSX:
<Menu messages="{"de":{"propertyUnknownType":"'{{name}}' Eigenschaft ist mit undefined 'Typ'-Member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Modul ist nicht definiert.","missingReference":"{{elementType}}: Fehlender Verweis auf {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser unterstutzt keine HTMLTemplate-Elemente.","invalidTemplate":"{{elementType}}: '{{property}}' Die Eigenschaft akzeptiert eine Zeichenfolge, die mit der ID eines HTMLTemplate-Elements aus dem DOM ubereinstimmen muss."}}" />Imperative (ref from createRef / useRef):
menuRef.current!.messages = {"en":{"propertyUnknownType":"'{{name}}' property is with undefined 'type' member!","propertyInvalidValue":"Invalid '{{name}}' property value! Actual value: {{actualValue}}, Expected value: {{value}}!","propertyInvalidValueType":"Invalid '{{name}}' property value type! Actual type: {{actualType}}, Expected type: {{type}}!","elementNotInDOM":"Element does not exist in DOM! Please, add the element to the DOM, before invoking a method.","moduleUndefined":"Module is undefined.","missingReference":"{{elementType}}: Missing reference to {{files}}.","htmlTemplateNotSuported":"{{elementType}}: Browser doesn't support HTMLTemplate elements.","invalidTemplate":"{{elementType}}: '{{property}}' property accepts a string that must match the id of an HTMLTemplate element from the DOM."}};Read the current value:
const messages = menuRef.current!.messages;
minimizeIconTemplateLoads a custom minimize icon from an HTMLTemplateElement selected by its ID. The element’s inner HTML is used as the icon’s template, allowing for flexible and reusable icon customization within the application.string
Loads a custom minimize icon from an HTMLTemplateElement selected by its ID. The element’s inner HTML is used as the icon’s template, allowing for flexible and reusable icon customization within the application.
Default value
"null"Examples
Markup and runtime examples for minimizeIconTemplate:
JSX:
<Menu minimizeIconTemplate="template1" />
Imperative (ref from createRef / useRef):
menuRef.current!.minimizeIconTemplate = "template2";
Read the current value:
const minimizeIconTemplate = menuRef.current!.minimizeIconTemplate;
minimizeWidthSpecifies the minimum width (in pixels) at which the Menu transitions from its normal (expanded) state to a minimized (collapsed) mode. When the Menu’s container width falls below this threshold, the minimized mode is automatically activated. If set to null, the Menu will remain in its normal state regardless of width and will not minimize automatically.number
Specifies the minimum width (in pixels) at which the Menu transitions from its normal (expanded) state to a minimized (collapsed) mode. When the Menu’s container width falls below this threshold, the minimized mode is automatically activated. If set to null, the Menu will remain in its normal state regardless of width and will not minimize automatically.
Examples
Markup and runtime examples for minimizeWidth:
JSX:
<Menu minimizeWidth={100} />Imperative (ref from createRef / useRef):
menuRef.current!.minimizeWidth = 200;
Read the current value:
const minimizeWidth = menuRef.current!.minimizeWidth;
modeSpecifies how the menu is visually presented to users, such as in a horizontal, vertical, dropdown, or collapsible format. Adjusting this setting allows customization of the menu’s layout and interaction style."horizontal" | "vertical" | "dropDown" | "tree"
Specifies how the menu is visually presented to users, such as in a horizontal, vertical, dropdown, or collapsible format. Adjusting this setting allows customization of the menu’s layout and interaction style.
Allowed Values
- "horizontal" - Menu root items are displayed horizontally and the drop down appears below/above or over the element.
- "vertical" - Menu root items are displayed vertically and the drop down appears to the left/right or over the element.
- "dropDown" - The menu acts as a popup. It's hidden by default. Calling the open and close methods can show or hide it.
- "tree" - The menu appears as a tree and all items are aligned according to their parents.
Default value
"horizontal"Examples
Markup and runtime examples for mode:
JSX:
<Menu mode="vertical" />
Imperative (ref from createRef / useRef):
menuRef.current!.mode = "dropDown";
Read the current value:
const mode = menuRef.current!.mode;
openedToggles the menu’s visibility when it is set to 'dropDown' mode, allowing users to open or close the menu as needed.boolean
Toggles the menu’s visibility when it is set to 'dropDown' mode, allowing users to open or close the menu as needed.
Default value
falseExamples
Markup and runtime examples for opened:
JSX — boolean prop:
<Menu opened={true} />Imperative (ref from createRef / useRef):
menuRef.current!.opened = false;
Read the current value:
const opened = menuRef.current!.opened;
overflowDefines how the menu's scroll buttons behave when navigating through its items. This property is effective only if dropDownAppendTo is set to a value other than null. If dropDownAppendTo is null, the scroll button behavior setting is ignored."auto" | "hidden" | "scroll"
Defines how the menu's scroll buttons behave when navigating through its items. This property is effective only if dropDownAppendTo is set to a value other than null. If dropDownAppendTo is null, the scroll button behavior setting is ignored.
Allowed Values
- "auto" - The scroll buttons are automatically shown/hidden depending on the visibility of the items. If there's an item that is not visible the appropriate scroll button will appear in order to fully scroll to it.
- "hidden" - The scroll buttons are hidden.
- "scroll" - The scroll buttons are always visible.
Default value
"auto"Examples
Markup and runtime examples for overflow:
JSX:
<Menu overflow="hidden" />
Imperative (ref from createRef / useRef):
menuRef.current!.overflow = "scroll";
Read the current value:
const overflow = menuRef.current!.overflow;
preventCloseOnCheckIf set to true, the Menu and its dropdowns will remain open when a Menu item is checked or unchecked, rather than automatically closing upon selection. This allows users to make multiple selections without the Menu closing each time an item is toggled.boolean
If set to true, the Menu and its dropdowns will remain open when a Menu item is checked or unchecked, rather than automatically closing upon selection. This allows users to make multiple selections without the Menu closing each time an item is toggled.
Default value
falseExamples
Markup and runtime examples for preventCloseOnCheck:
JSX — boolean prop:
<Menu preventCloseOnCheck={true} />Imperative (ref from createRef / useRef):
menuRef.current!.preventCloseOnCheck = false;
Read the current value:
const preventCloseOnCheck = menuRef.current!.preventCloseOnCheck;
readonlyWhen the element is set to "readonly," users can view its content but are unable to modify or edit the value. However, users may still interact with the element in limited ways, such as selecting and copying its content. The element remains focusable, but any attempts to change its data will be ignored.boolean
When the element is set to "readonly," users can view its content but are unable to modify or edit the value. However, users may still interact with the element in limited ways, such as selecting and copying its content. The element remains focusable, but any attempts to change its data will be ignored.
Default value
falseExamples
Markup and runtime examples for readonly:
JSX — boolean prop:
<Menu readonly={true} />Imperative (ref from createRef / useRef):
menuRef.current!.readonly = true;
Read the current value:
const readonly = menuRef.current!.readonly;
rightToLeftSpecifies or retrieves whether the element’s alignment is configured to support locales that use right-to-left (RTL) text direction, such as Arabic or Hebrew. When enabled, the element’s content and layout are adjusted for proper display in RTL languages.boolean
Specifies or retrieves whether the element’s alignment is configured to support locales that use right-to-left (RTL) text direction, such as Arabic or Hebrew. When enabled, the element’s content and layout are adjusted for proper display in RTL languages.
Default value
falseExamples
Markup and runtime examples for rightToLeft:
JSX — boolean prop:
<Menu rightToLeft={true} />Imperative (ref from createRef / useRef):
menuRef.current!.rightToLeft = false;
Read the current value:
const rightToLeft = menuRef.current!.rightToLeft;
selectionModeSpecifies how users can select items within the menu, such as allowing single selection, multiple selections, or no selection."click" | "mouseenter"
Specifies how users can select items within the menu, such as allowing single selection, multiple selections, or no selection.
Allowed Values
- "click" - A menu item is selected when clicked.
- "mouseenter" - A menu item is selected when hovered
Default value
"click"Examples
Markup and runtime examples for selectionMode:
JSX:
<Menu selectionMode="mouseenter" />
Imperative (ref from createRef / useRef):
menuRef.current!.selectionMode = "click";
Read the current value:
const selectionMode = menuRef.current!.selectionMode;
themeSpecifies the theme to be applied. The selected theme controls the visual appearance and styling of the element, including colors, fonts, spacing, and other design aspects.string
Specifies the theme to be applied. The selected theme controls the visual appearance and styling of the element, including colors, fonts, spacing, and other design aspects.
Default value
""Examples
Markup and runtime examples for theme:
JSX:
<Menu theme="blue" />
Imperative (ref from createRef / useRef):
menuRef.current!.theme = "red";
Read the current value:
const theme = menuRef.current!.theme;
unfocusableWhen set to true, the element is removed from the tab order and cannot be focused using keyboard navigation or script.boolean
When set to true, the element is removed from the tab order and cannot be focused using keyboard navigation or script.
Default value
falseExamples
Markup and runtime examples for unfocusable:
JSX — boolean prop:
<Menu unfocusable={true} />Imperative (ref from createRef / useRef):
menuRef.current!.unfocusable = false;
Read the current value:
const unfocusable = menuRef.current!.unfocusable;
unlockKeyRetrieves or assigns the unlockKey, a unique code required to activate and access the product's full features.string
Retrieves or assigns the unlockKey, a unique code required to activate and access the product's full features.
Default value
""Examples
Markup and runtime examples for unlockKey:
JSX:
<Menu unlockKey="" />
Imperative (ref from createRef / useRef):
menuRef.current!.unlockKey = "1111-2222-3333-4444-5555";
Read the current value:
const unlockKey = menuRef.current!.unlockKey;
valueMemberSpecifies which field in the data source should be used as the value for each item. This property maps a particular key or column from your data to represent the item's value in the component, enabling proper identification, selection, and data binding.string
Specifies which field in the data source should be used as the value for each item. This property maps a particular key or column from your data to represent the item's value in the component, enabling proper identification, selection, and data binding.
Default value
"value"Examples
Markup and runtime examples for valueMember:
JSX:
<Menu valueMember="info" />
Imperative (ref from createRef / useRef):
menuRef.current!.valueMember = "details";
Read the current value:
const valueMember = menuRef.current!.valueMember;
Events
onCloseThis event is triggered whenever the menu is closed by the user. It is only fired when the component is operating in 'dropDown' mode; other modes do not emit this event. Use this event to perform actions or cleanup tasks when the drop-down menu is dismissed.CustomEvent
This event is triggered whenever the menu is closed by the user. It is only fired when the component is operating in 'dropDown' mode; other modes do not emit this event. Use this event to perform actions or cleanup tasks when the drop-down menu is dismissed.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onClose
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for close using the pattern that matches your stack.
JSX
<Menu onClose={handleClose} />Handler
function handleClose(event: CustomEvent) {
// handle event …
}
onClosingThis event is dispatched immediately before the menu begins to close, providing an opportunity to intercept the closing operation. By invoking event.preventDefault() within the event handler, you can cancel the menu’s closure, allowing for custom logic or validation before the menu actually closes. Note that this event is only fired when the menu is operating in 'dropDown' mode; it does not apply to other display modes.CustomEvent
This event is dispatched immediately before the menu begins to close, providing an opportunity to intercept the closing operation. By invoking event.preventDefault() within the event handler, you can cancel the menu’s closure, allowing for custom logic or validation before the menu actually closes. Note that this event is only fired when the menu is operating in 'dropDown' mode; it does not apply to other display modes.
- Bubbles Yes
- Cancelable Yes
- Interface CustomEvent
- Event handler property onClosing
Arguments
evCustomEvent
ev.detailObject
ev.detail.trigger - Indicates whether the event was called from inside the element or programatically.
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for closing using the pattern that matches your stack.
JSX
<Menu onClosing={handleClosing} />Handler
function handleClosing(event: CustomEvent) {
const detail = event.detail,
trigger = detail.trigger;
// handle event …
}
onCollapseThis event is triggered whenever a smart-menu-items-group is collapsed, indicating that a previously expanded group of menu items within the smartMenu component has been closed by the user or through a programmatic action. Use this event to perform custom actions or UI updates in response to the group collapsing.CustomEvent
This event is triggered whenever a smart-menu-items-group is collapsed, indicating that a previously expanded group of menu items within the smartMenu component has been closed by the user or through a programmatic action. Use this event to perform custom actions or UI updates in response to the group collapsing.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onCollapse
Arguments
evCustomEvent
ev.detailObject
ev.detail.item - The menu item that was collapsed.
ev.detail.label - The label of the toggled item that was collapsed.
ev.detail.value - The value of the toggled item that was collapsed.
ev.detail.path - The path of the toggled item that was collapsed, e.g. '0.1', '1.1.2'.
ev.detail.children - The children items of the toggled item that was collapsed.
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for collapse using the pattern that matches your stack.
JSX
<Menu onCollapse={handleCollapse} />Handler
function handleCollapse(event: CustomEvent) {
const detail = event.detail,
item = detail.item,
label = detail.label,
value = detail.value,
path = detail.path,
children = detail.children;
// handle event …
}
onCollapsingThis event is triggered immediately before a smart-menu-items-group begins to collapse, allowing developers to execute custom logic or prevent the group from collapsing if necessary. It provides an opportunity to handle user interactions or update the user interface in response to the group collapsing action.CustomEvent
This event is triggered immediately before a smart-menu-items-group begins to collapse, allowing developers to execute custom logic or prevent the group from collapsing if necessary. It provides an opportunity to handle user interactions or update the user interface in response to the group collapsing action.
- Bubbles Yes
- Cancelable Yes
- Interface CustomEvent
- Event handler property onCollapsing
Arguments
evCustomEvent
ev.detailObject
ev.detail.item - The menu item that is going to be collapsed.
ev.detail.label - The label of the toggled item that is going to be collapsed.
ev.detail.value - The value of the toggled item that is going to be collapsed.
ev.detail.path - The path of the toggled item that is going to be collapsed, e.g. '0.1', '1.1.2'.
ev.detail.children - The children items of the toggled item that is going to be collapsed.
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for collapsing using the pattern that matches your stack.
JSX
<Menu onCollapsing={handleCollapsing} />Handler
function handleCollapsing(event: CustomEvent) {
const detail = event.detail,
item = detail.item,
label = detail.label,
value = detail.value,
path = detail.path,
children = detail.children;
// handle event …
}
onExpandThis event is triggered whenever a smart-menu-items-group component is expanded by the user, either through a click or programmatic action. It allows you to execute custom logic in response to a menu group opening.CustomEvent
This event is triggered whenever a smart-menu-items-group component is expanded by the user, either through a click or programmatic action. It allows you to execute custom logic in response to a menu group opening.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onExpand
Arguments
evCustomEvent
ev.detailObject
ev.detail.item - The menu item that was expanded.
ev.detail.label - The label of the toggled item that was expanded.
ev.detail.value - The value of the toggled item that was expanded.
ev.detail.path - The path of the toggled item that was expanded, e.g. '0.1', '1.1.2'.
ev.detail.children - The children items of the toggled item that was expanded.
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for expand using the pattern that matches your stack.
JSX
<Menu onExpand={handleExpand} />Handler
function handleExpand(event: CustomEvent) {
const detail = event.detail,
item = detail.item,
label = detail.label,
value = detail.value,
path = detail.path,
children = detail.children;
// handle event …
}
onExpandingThis event is fired immediately before a smart-menu-items-group begins to expand, allowing you to execute custom logic or cancel the expansion operation if needed. Use this event to intervene right before the menu group becomes visible to the user.CustomEvent
This event is fired immediately before a smart-menu-items-group begins to expand, allowing you to execute custom logic or cancel the expansion operation if needed. Use this event to intervene right before the menu group becomes visible to the user.
- Bubbles Yes
- Cancelable Yes
- Interface CustomEvent
- Event handler property onExpanding
Arguments
evCustomEvent
ev.detailObject
ev.detail.item - The menu item that is going to be expanded.
ev.detail.label - The label of the toggled item that is going to be expanded.
ev.detail.value - The value of the toggled item that is going to be expanded.
ev.detail.path - The path of the toggled item that is going to be expanded, e.g. '0.1', '1.1.2'.
ev.detail.children - The children items of the toggled item that is going to be expanded.
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for expanding using the pattern that matches your stack.
JSX
<Menu onExpanding={handleExpanding} />Handler
function handleExpanding(event: CustomEvent) {
const detail = event.detail,
item = detail.item,
label = detail.label,
value = detail.value,
path = detail.path,
children = detail.children;
// handle event …
}
onItemCheckChangeThis event is triggered whenever the checked or unchecked state of a menu item is changed by the user or programmatically. It provides details about which menu item was affected and the new check state, allowing developers to respond to the change accordingly, such as updating the UI or processing the selected option.CustomEvent
This event is triggered whenever the checked or unchecked state of a menu item is changed by the user or programmatically. It provides details about which menu item was affected and the new check state, allowing developers to respond to the change accordingly, such as updating the UI or processing the selected option.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onItemCheckChange
Arguments
evCustomEvent
ev.detailObject
ev.detail.item - The menu item which state was changed.
ev.detail.label - The label of the item which state was changed.
ev.detail.value - The value of the item which state was changed.
ev.detail.checked - The checked state of the toggled item. If false the item is not toggled.
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for itemCheckChange using the pattern that matches your stack.
JSX
<Menu onItemCheckChange={handleItemCheckChange} />Handler
function handleItemCheckChange(event: CustomEvent) {
const detail = event.detail,
item = detail.item,
label = detail.label,
value = detail.value,
checked = detail.checked;
// handle event …
}
onItemClickThis event is triggered whenever a user clicks on a menu item. It provides information about the selected menu item, allowing you to handle user interactions, perform actions based on the item selected, or update the interface accordingly.CustomEvent
This event is triggered whenever a user clicks on a menu item. It provides information about the selected menu item, allowing you to handle user interactions, perform actions based on the item selected, or update the interface accordingly.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onItemClick
Arguments
evCustomEvent
ev.detailObject
ev.detail.item - The menu item that is toggled.
ev.detail.label - The label of the toggled item.
ev.detail.value - The value of the toggled item.
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for itemClick using the pattern that matches your stack.
JSX
<Menu onItemClick={handleItemClick} />Handler
function handleItemClick(event: CustomEvent) {
const detail = event.detail,
item = detail.item,
label = detail.label,
value = detail.value;
// handle event …
}
onOpenThis event is triggered whenever the menu is opened by the user. It is only fired when the component is operating in 'dropDown' mode; in all other modes, this event will not be triggered. Use this event to perform actions when the drop-down menu becomes visible.CustomEvent
This event is triggered whenever the menu is opened by the user. It is only fired when the component is operating in 'dropDown' mode; in all other modes, this event will not be triggered. Use this event to perform actions when the drop-down menu becomes visible.
- Bubbles Yes
- Cancelable No
- Interface CustomEvent
- Event handler property onOpen
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for open using the pattern that matches your stack.
JSX
<Menu onOpen={handleOpen} />Handler
function handleOpen(event: CustomEvent) {
// handle event …
}
onOpeningThis event is triggered immediately before the menu is opened, giving you the opportunity to intervene before the menu becomes visible. Within your event handler, you can prevent the menu from opening by calling event.preventDefault(). Note that this event is only emitted when the menu is operating in 'dropDown' mode; it will not be fired in any other mode.CustomEvent
This event is triggered immediately before the menu is opened, giving you the opportunity to intervene before the menu becomes visible. Within your event handler, you can prevent the menu from opening by calling event.preventDefault(). Note that this event is only emitted when the menu is operating in 'dropDown' mode; it will not be fired in any other mode.
- Bubbles Yes
- Cancelable Yes
- Interface CustomEvent
- Event handler property onOpening
Arguments
evCustomEvent
Methods
isDefaultPrevented
Returns true if the event was prevented by any of its subscribers.
Returns
boolean true if the default action was prevented. Otherwise, returns false.
preventDefault
The preventDefault() method prevents the default action for a specified event. In this way, the source component suppresses the built-in behavior that follows the event.
stopPropagation
The stopPropagation() method of the Event interface prevents further propagation of the current event in the capturing and bubbling phases.
Examples
Listen for opening using the pattern that matches your stack.
JSX
<Menu onOpening={handleOpening} />Handler
function handleOpening(event: CustomEvent) {
// handle event …
}
Methods
addItem( Item: HTMLElement, Parent?: HTMLElement | string): voidAdds a new item to the menu by appending the specified entry, including its label, action, and any associated properties, to the existing menu structure. This allows dynamic expansion of the menu options displayed to users.
Adds a new item to the menu by appending the specified entry, including its label, action, and any associated properties, to the existing menu structure. This allows dynamic expansion of the menu options displayed to users.
Arguments
ItemHTMLElement
A smart-menu-item to add to the Menu.
Parent?HTMLElement | string
The smart-menu-items-group or its id or numeric path to add the item to.
Through a React ref to the wrapper component:
menuRef.current?.addItem("document.createElement('smart-menu-item')","0");
Try a demo showcasing the addItem method.
checkItem( item: HTMLElement | string): voidMarks the specified item as checked or selected, updating its status to indicate it is active, enabled, or chosen.
Marks the specified item as checked or selected, updating its status to indicate it is active, enabled, or chosen.
Arguments
itemHTMLElement | string
smart-menu-item/smart-menu-items-group or its id or numeric path.
Through a React ref to the wrapper component:
menuRef.current?.checkItem("0.0");
Try a demo showcasing the checkItem method.
clear(): voidRemoves all existing items from the Menu, resulting in an empty Menu with no selectable options.
Removes all existing items from the Menu, resulting in an empty Menu with no selectable options.
Through a React ref to the wrapper component:
menuRef.current?.clear();
Try a demo showcasing the clear method.
clickItem( item: HTMLElement | string): voidSimulates a user click event on a specified item programmatically, triggering any associated event handlers or actions as if the item were clicked manually by the user.
Simulates a user click event on a specified item programmatically, triggering any associated event handlers or actions as if the item were clicked manually by the user.
Arguments
itemHTMLElement | string
smart-menu-item/smart-menu-items-group or its id or numeric path.
Through a React ref to the wrapper component:
menuRef.current?.clickItem("menuItemRef");
close(): voidAutomatically closes the Menu when the mode property is set to 'dropDown', ensuring that the menu is dismissed upon selection or when clicking outside the menu area. This behavior provides a streamlined user experience consistent with standard dropdown functionality.
Automatically closes the Menu when the mode property is set to 'dropDown', ensuring that the menu is dismissed upon selection or when clicking outside the menu area. This behavior provides a streamlined user experience consistent with standard dropdown functionality.
Through a React ref to the wrapper component:
menuRef.current?.close();
Try a demo showcasing the close method.
collapseItem( item?: HTMLElement | string, animation?: boolean): voidCollapses a currently expanded item, hiding its content from view and displaying only the header or summary. This is typically used in expandable/collapsible components such as accordions or dropdown menus.
Collapses a currently expanded item, hiding its content from view and displaying only the header or summary. This is typically used in expandable/collapsible components such as accordions or dropdown menus.
Arguments
item?HTMLElement | string
smart-menu-item/smart-menu-items-group or its id or numeric path. If no item is passed, all open items are collapsed.
animation?boolean
If set to false, disables collapse animation even if animation is enabled for the element.
Through a React ref to the wrapper component:
menuRef.current?.collapseItem("0.0");
expandItem( item: HTMLElement | string, animation?: boolean): voidDisplays the detailed content or additional information of an item by expanding its view, typically used in accordions, dropdowns, or collapsible sections.
Displays the detailed content or additional information of an item by expanding its view, typically used in accordions, dropdowns, or collapsible sections.
Arguments
itemHTMLElement | string
smart-menu-item/smart-menu-items-group or its id or numeric path.
animation?boolean
If set to false, disables expand animation even if animation is enabled for the element.
Through a React ref to the wrapper component:
menuRef.current?.expandItem("1.2");
getItem( id: string): HTMLElementRetrieves a specific item using either its unique identifier (ID) or a numeric path value. This allows you to access an item directly by providing its assigned ID or by specifying its position within a structured path.
Retrieves a specific item using either its unique identifier (ID) or a numeric path value. This allows you to access an item directly by providing its assigned ID or by specifying its position within a structured path.
Arguments
idstring
The id or numeric path of an item
ReturnsHTMLElement
Through a React ref to the wrapper component:
const result = menuRef.current?.getItem("0.0");
maximize(): voidExpands the menu to display all available options, maximizing its visibility and accessibility for the user.
Expands the menu to display all available options, maximizing its visibility and accessibility for the user.
Through a React ref to the wrapper component:
menuRef.current?.maximize();
minimize(): voidCollapses the navigation menu to its minimized or compact state, reducing its visible size to save screen space while still providing access to essential menu options.
Collapses the navigation menu to its minimized or compact state, reducing its visible size to save screen space while still providing access to essential menu options.
Through a React ref to the wrapper component:
menuRef.current?.minimize();
open( left: number, top: number): voidOpens the Menu component only when the mode property is set to 'dropDown'. In this mode, the Menu will become visible in a dropdown format, allowing users to interact with its items. If mode is set to any other value, the Menu will not open.
Opens the Menu component only when the mode property is set to 'dropDown'. In this mode, the Menu will become visible in a dropdown format, allowing users to interact with its items. If mode is set to any other value, the Menu will not open.
Arguments
leftnumber
Horizontal position
topnumber
Vertical position
Through a React ref to the wrapper component:
menuRef.current?.open();
Try a demo showcasing the open method.
removeItem( item: HTMLElement | string): voidRemoves a specified item from the menu, updating the menu structure to reflect the change. This action ensures the targeted menu item is no longer displayed or accessible within the menu interface.
Removes a specified item from the menu, updating the menu structure to reflect the change. This action ensures the targeted menu item is no longer displayed or accessible within the menu interface.
Arguments
itemHTMLElement | string
The smart-menu-item/smart-menu-items-group or its id or numeric path to remove.
Through a React ref to the wrapper component:
menuRef.current?.removeItem("0.0");
Try a demo showcasing the removeItem method.
uncheckItem( item: HTMLElement | string): voidUnselects or removes the checkmark from a selected item, indicating that it is no longer active, chosen, or included in the current selection.
Unselects or removes the checkmark from a selected item, indicating that it is no longer active, chosen, or included in the current selection.
Arguments
itemHTMLElement | string
smart-menu-item/smart-menu-items-group (or its id or numeric path)
Through a React ref to the wrapper component:
menuRef.current?.uncheckItem("0.0");
Try a demo showcasing the uncheckItem method.
CSS Variables
--smart-menu-default-widthvar()
Default value
"var(--smart-bar-width)"smartMenu default width
--smart-menu-default-heightvar()
Default value
"var(--smart-bar-height)"smartMenu default height
--smart-menu-vertical-default-widthvar()
Default value
"calc(var(--smart-bar-width) / 2)"vertical and context smartMenu default width
--smart-menu-vertical-default-heightvar()
Default value
"var(--smart-bar-width)"vertical and context smartMenu default height
--smart-menu-scroll-button-sizevar()
Default value
"calc(var(--smart-bar-height) / 1.5)"smartMenu scroll buttons size. Horizontal Menu scroll buttons width = Vertical Menu scroll buttons height.
MenuItem
Defines a menu item.
Selector
<MenuItem>
Properties
Properties
checkedboolean
Default value
trueJSX — boolean prop:
<MenuItem checked={true} />disabledControls whether the element is enabled or disabled. When set to true, the element is interactive and can receive user input; when set to false, the element is disabled, preventing user interaction and applying a disabled appearance as appropriate.boolean
Controls whether the element is enabled or disabled. When set to true, the element is interactive and can receive user input; when set to false, the element is disabled, preventing user interaction and applying a disabled appearance as appropriate.
Default value
falseExamples
Markup and runtime examples for disabled:
JSX — boolean prop:
<MenuItem disabled={true} />Imperative (ref from createRef / useRef):
menuitemRef.current!.disabled = false;
Read the current value:
const disabled = menuitemRef.current!.disabled;
labelany
Default value
""levelnumber
separatorboolean
Default value
trueJSX — boolean prop:
<MenuItem separator={true} />shortcutstring
Default value
""valueany
MenuItemsGroup
Defines a group of menu items.
Selector
<MenuItemsGroup>
Properties
Properties
checkableboolean
Default value
falseJSX — boolean prop:
<MenuItemsGroup checkable={true} />checkedboolean
Default value
falseJSX — boolean prop:
<MenuItemsGroup checked={true} />checkMode"checkbox" | "radioButton"
Default value
"checkbox"disabledSpecifies whether the element is enabled or disabled. When set to true, the element is disabled and cannot be interacted with by the user; when set to false, the element remains enabled and fully interactive.boolean
Specifies whether the element is enabled or disabled. When set to true, the element is disabled and cannot be interacted with by the user; when set to false, the element remains enabled and fully interactive.
Default value
falseExamples
Markup and runtime examples for disabled:
JSX — boolean prop:
<MenuItemsGroup disabled={true} />Imperative (ref from createRef / useRef):
menuitemsgroupRef.current!.disabled = false;
Read the current value:
const disabled = menuitemsgroupRef.current!.disabled;
dropDownHeightnumber
expandedboolean
Default value
falseJSX — boolean prop:
<MenuItemsGroup expanded={true} />labelany
Default value
""levelnumber
separatorboolean
Default value
falseJSX — boolean prop:
<MenuItemsGroup separator={true} />valueany