As I mentioned in the other post, you can’t add icons to the buttons of an updatemenu yet, at least not directly. I’ll leave you this option using the modebar since it’s the only thing that Plotly has that has buttons with icons, even so, it was inevitable to have to use JS to be able to move it from one position to another. This is another limitation that Plotly has of not being able to move the position of that bar
On the other hand, you had mentioned that you needed to use Fontawesome icons, but it’s still not possible to add them directly since Fontawesome icons are embedded using an <i>
tag, while the buttons and the modebar are <svg><g><rect><text>
graphic elements that don’t accept the <i>
tag. Your option would be to convert those icons to SVG and get the path. There are many tutorials on the Internet on how to do this.
Now another problem is that if you use the modebar, you can’t create multiple modebars like you can with the updatemenus, you only have one modebar, so if you were using the modebar to have other buttons they will all be in the same bar.
I don’t understand how it is that if they already have the logic to embed icons in the modebar they don’t apply the same code for the updatemenu buttons, hopefully in other versions they will implement it.
Another option would be to create shapes with xref paper and position them above the buttons, but the problem is that shapes do not support complex icons, much less if they include “A” in the path, and you would have to convert the path to paper coordinates and possibly not pass the click event to the button below
The other option that I mentioned in the other post is to access the buttons and embed the icon with JS, the buttons are not <button>
tags, they are actually a <g>
tag that groups several <rect>
and <text>
to create the buttons
Personally, I create my own buttons with <button>
and I position them where I want with absolute divs
https://codepen.io/saratoga01/pen/KwKXwQY?editors=0010