FontAwesome as Icon

Hi
Can we use FontAwesome as icon in CUBA application? Any example?

Yes you can.
See https://doc.cuba-platform.com/manual-6.0/gui_attributes.html#gui_attr_icon
Font elements of Font Awesome can be used instead of files in web client with Halo theme (or derived from it). For this, specify the name of the required constant of the com.vaadin.server.FontAwesome class in the icon property with the font-icon: prefix, for example:

icon="font-icon:BOOK"

See also https://doc.cuba-platform.com/manual-6.0/search.jsp?searchTerms=FontAwesome

Thank you. it worked perfectly.

Hi
Noticed that, some icons doesn’t work. For example:


font-icon:TRASH

font-icon:plus-square-o

Any clue?

Hi Mortoza,

Cuba 6.0.* uses FontAwesome of version 4.1.0
Icon TRASH have been added in FontAwesome 4.2 and is not currently available in Cuba 6.0.*
You can see the version of FontAwesome for specific icon on FontAwesome website: [url=http://fortawesome.github.io/Font-Awesome/icons/]http://fortawesome.github.io/Font-Awesome/icons/[/url]

As to your second icon, please try using this reference:

font-icon:PLUS_SQUARE_O

You can find all the icon definitions in class FontAwesome.java in your IDE (for Intellij on Mac press Cmd+Shift+O and type FontAwesome.java)

1 Like

Thanks for the feedback. How about Cuba 6.1, does it support a higher version?

CUBA 6.1 includes FontAwesome 4.5.0, so you can use font-icon:TRASH

A post was split to a new topic: FontAwesome icons in CUBA 6.9