Picture of Jason Wilson
Best way to add a custom button?
by Jason Wilson - Monday, 29 March 2021, 4:10 AM
 

Hi guys, presuming there isn't a button component (I couldn't find one), what is the best way to add a button into a text area etc.? 

Do I need to create one from scratch using CSS, or is something already created?

EG: create a button to link to an external website.

This is for the Author Tool.

Thanks for any help!

Picture of Paul Steven
Re: Best way to add a custom button?
by Paul Steven - Monday, 29 March 2021, 6:42 AM
 

Hi Jason

 

You could just go to source in a text component (click the source button in the WYSIWYG)

And put something like

<p><a class="websiteBtn" href="http://www.google.com">website</a></p>

You can then add styling using the Custom CSS/LESS code in Project settings

a.websiteBtn {

   styling goes here

}

 

Picture of Jason Wilson
Re: Best way to add a custom button?
by Jason Wilson - Monday, 29 March 2021, 9:09 PM
 

Hi Paul, thanks. I did try this but found that it was 50/50 as to whether the custom code would stay in the WYSIWYG editor after I saved it. 

Picture of Paul Steven
Re: Best way to add a custom button?
by Paul Steven - Tuesday, 30 March 2021, 8:47 AM
 

Hi Jason

I didn't expect my code to remain in the editor when I closed the reopened it but surprisingly it was still there.

However another approach you could use is to set a custom class on the component e.g customLink

You then just add a hyperlink using the WYSIWYG editor (no need to view source)

Then in the custom CSS section add something like this:

.customLink a {
background-color: yellow;
}

 

Note this would make all links in that particular text component have a yellow background.