[Solved] Is it possible to use LineAwesome Icons as Icon in badges?

As described here: https://vaadin.com/docs/latest/components/badge/#icon-only I’m going to put some badges into a grid to mark some important booleans. I would like to use an icon from LineAwesome but yet (too early probably here…) have no idea to set it as an icon.

Kind of LineAwesome.la-check instead of VaadinIcon.CHECK seems not the correct way as it doesn’t work :slightly_smiling_face:

How to achieve that?
Using Vaadin 23 btw.

You apply the correct css classes to e.g. a span or i element and add those instead of Vaadin Icons

as knoobie said, this works:

        var label = "Yes";
        Span span = new Span();
        {
            span.getElement().getThemeList().add("badge success");
            var icon = LineAwesomeIcon.CHECK_SOLID.create();
            span.add(icon);
            icon.getStyle().set("width", "0.5em");
            icon.getStyle().set("height", "0.5em");
            icon.getStyle().set("padding", "var(--lumo-space-xs");
            icon.getElement().setAttribute("aria-label", label);
            icon.getElement().setAttribute("title", label);
        }

Setting the badge theme directly to the LineAwesomeIcon doesn’t seem to work the same way it does for VaadinIcon as shown in the docs

Thank you, so only “issue” left: What to do to resolve
var icon = LineAwesomeIcon.CHECK_SOLID.create();

Haven’t used these icons before but know them from the vaadin starter Appnav…

Sorry if these questions sound stupid, but right now it’s difficult for me to see how everything has to put together… :person_shrugging:

import org.vaadin.lineawesome.LineAwesomeIcon;

A good IDE should find the dependency and suggest that import automatically though

https://tenor.com/view/facepalm-picard-star-trek-the-next-generation-disappointed-gif-23456183

it does - usually - if I don’t forget to add the maven dependency…

        <dependency>
            <groupId>org.parttio</groupId>
            <artifactId>line-awesome</artifactId>
            <version>1.1.0</version>
        </dependency>

building now, will respond asap :slightly_smiling_face:

hmmm everythiing is in place, nothing red within the IDE anymore, resolving the different Icons works, but when trying to open the view I get
java.lang.ClassNotFoundException: org.vaadin.lineawesome.LineAwesomeIcon

going to clean up all and rebuild

finally :slightly_smiling_face:

Thanks - it works now as desired.

[Solved] Is it possible to use LineAwesome Icons as Icon in badges?