Edit in GitHubLog an issue

sp-menu-item

Since: UXP v4.1

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}):
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.