Custom button with arrow

Hi,
I’m learning WE and want to create a custom button with arrow. It is very usual element in GUI.
Button consists of two parts: left part it classical button with icon, and right part - is small arrow - when you click then a popup menu is showed.
To how make such button in WE?

You can’t. You can however add a popup to a button or add context menu items to it.

If it’s not the end of the world my suggestion would be to add the primary action to the popup as an element to select, else to go with the context menu route.

I don’t think Browser Action and Page Action buttons can have both elements, the button and the menu-drop triangle on the side. Otherwise, we would see lots of them by now.

Plan B: You can attach context menu items to your button for the user to access on right-click.

You also can change the behavior of the button. For example, I have one that enables the extension to start listening for events, and that changes the image on the button. Then if you click the button again, it drops a menu of things that make sense while the extension is running.

Example function to handle clicks on the button based on a global variable: https://github.com/jscher2000/Content-Type-Fixer-extension/blob/master/background.js#L169

Example function to change button handling based on messages from a popup page: https://github.com/jscher2000/Content-Type-Fixer-extension/blob/master/background.js#L222