[FEATURE] FontAwesome Icons
CI / build-and-test (pull_request) Successful in 1m9s

This commit is contained in:
Pit Friedrich
2026-07-19 23:39:10 +02:00
parent 38d3cbe38a
commit aca411ca9e
8 changed files with 74 additions and 11 deletions
@@ -0,0 +1,34 @@
package com.example.components;
import com.vaadin.flow.component.icon.FontIcon;
/**
* Font Awesome Free icon references, mirroring the ergonomics of
* {@code VaadinIcon.create()}. Backed by the {@code fa-*} CSS classes
* shipped in the bundled {@code @fortawesome/fontawesome-free} package.
*
* <p>Font Awesome paints glyphs via {@code content: var(--fa)} on
* {@code ::before}; the glyph-specific class (e.g. {@code fa-sun}) is what
* defines that {@code --fa} custom property, so both the family class
* ({@code fa-solid}) and the glyph class must be present.
*/
public enum Fa {
MOON("fa-solid", "fa-moon"),
SUN("fa-solid", "fa-sun"),
DASHBOARD("fa-solid", "fa-gauge-high"),
FORM("fa-solid", "fa-rectangle-list"),
TABLE("fa-solid", "fa-table"),
GLOBE("fa-solid", "fa-globe"),
SEARCH("fa-solid", "fa-magnifying-glass");
private final String[] classes;
Fa(String... classes) {
this.classes = classes;
}
public FontIcon create() {
return new FontIcon(classes);
}
}