How to show an icon with commandLink:
<p:commandLink
styleClass="ui-icon ui-icon-plus"
action="#{bean.doSomething}" >
<h:outputText value="Add" />
</p:commandLink>
The outputText (Add) is not visible. What is the right way for commandLink to support icon? Thanks.
<p:commandLink action="#{bean.doSomething}">
<h:outputText value="Add" class="ui-icon ui-icon-plus"/> </p:commandLink>
My answer is a bit of a combination of the previous two answers, but it worked the best for me. Remove styleClass
, but you don't need to use graphicImage
.
Instead you can use the <i class=""></i>
tag.
<p:commandLink action="#{bean.doSomething}">
<h:outputText value="Add"/><i class="ui-icon ui-icon-plus"></i>
</p:commandLink>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With