Skip to main content
Known Participant
November 15, 2018
Question

Generate a standard button with an icon inside?

  • November 15, 2018
  • 2 replies
  • 1621 views

I've searched the forums and I know this has been asked around quite a bit but I can never find a completely clear answer. I'm looking to create a button with an icon and standard text next to it, like the image attached. I don't want to create an icon button but rather have a small icon within the button itself.

Any thoughts?

Thanks.

Ben

This topic has been closed for replies.

2 replies

Alan_AEDScripts
Inspiring
December 19, 2018

The most obvious way to do this is use an icon button, and bake in the text with the image. You can embed the binary string for the png in your file if you only want a jsx etc.

Another option would be using 'stack' layout and put an icon button (smaller width) over a normal button (for text) - both with same callback. Clunky and limited but works.    

zlovatt
Inspiring
November 15, 2018

Why the reluctance to use an icon button?


You could explore this method for drawing SVGs-- maybe create a group, draw the SVG on the left, add text on the write, and add an `onClick` for the whole group.

Known Participant
November 15, 2018

I guess I didn't think you could place live text in an icon button? I saw that SVG method which I thought was really cool but I noticed in that specific file all your icons cannot have bezier curves in them. Maybe I'm miss understanding what an icon button actually does or maybe you mean use an icon button but also make the text and SVG?