Edit in GitHubLog an issue

sp-menu-item

Since: UXP 4.1, PS 22.0.0

Renders a menu item, with an optional checkmark indicating selection.

Links

See:

Example

Copied to your clipboard
1<sp-menu-item>Chicago</sp-menu-item>
2<sp-menu-item selected>New York City</sp-menu-item>
3<sp-menu-item disabled>St. Louis</sp-menu-item>

Responding to events#


You can respond to a click on the menu item using the click event.

Copied to your clipboard
1document.querySelector(".yourMenuItem").addEventListener("click", evt => {
2 console.log("You clicked a menu item");
3 evt.target.selected = !evt.target.selected;
4}):