Font Awesome Free icon integration for JWebMP with Angular 20. Provides type-safe access to Font Awesome's scalable vector icons with support for Free Solid and Free Brands icon sets.
Built on Font Awesome 6 · Angular FontAwesome · JWebMP Core · JPMS module com.jwebmp.plugins.fontawesome5 · Java 25+
Version: 7.2.0 — Font Awesome Free integration with SVG rendering and TypeScript generation.
<dependency>
<groupId>com.jwebmp.plugins</groupId>
<artifactId>font-awesome</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>Gradle (Kotlin DSL)
implementation("com.jwebmp.plugins:font-awesome:2.0.0-SNAPSHOT")The plugin automatically includes Font Awesome dependencies:
{
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^7.2.0",
"@fortawesome/free-solid-svg-icons": "^7.2.0",
"@fortawesome/free-brands-svg-icons": "^6.2.2",
"@fortawesome/angular-fontawesome": "^4.0.0"
}
}- 2,000+ Free Icons — Font Awesome Free icon library (Free Solid, Free Brands)
- Type-Safe Java API — Compile-time safety with Java enums for icons and styles
- Multiple Icon Styles — Solid and Brand styles included
- SVG or Web Font — Choose between SVG rendering or classic CSS web fonts
- Icon Transformations — Rotate, flip, scale, position with fluent API
- Layering & Masking — Combine multiple icons with layers and masks
- Animation Effects — Built-in spin, pulse, and custom animations
- Sizing Options — Preset sizes from xs to 10x, or custom sizing
- Angular Integration — Auto-loaded via Angular FontAwesome module
- CRTP Fluent API — Method chaining for icon configuration
- Zero Configuration — Auto-registered via ServiceLoader SPI
- Java 25 LTS (required)
- Maven 3.8+
- Node.js 18+ (for frontend builds)
- Angular 20+ (auto-integrated via JWebMP)
import com.jwebmp.plugins.fontawesome5.FontAwesome;
import com.jwebmp.plugins.fontawesome5.icons.FontAwesomeIcons;
import com.jwebmp.plugins.fontawesome5.options.FontAwesomeStyles;
// Create a solid icon
FontAwesome icon = new FontAwesome(FontAwesomeStyles.Solid, FontAwesomeIcons.cog);
// Create icons using factory methods
FontAwesome solidIcon = IFontAwesome.createIcon(FontAwesomeIcons.cog, FontAwesomeStyles.Solid);
FontAwesome brandIcon = IFontAwesome.createIcon(FontAwesomeBrandIcons.github, FontAwesomeStyles.Brand);import com.jwebmp.plugins.fontawesome5.IFontAwesome;
import com.jwebmp.plugins.fontawesome5.options.*;
// Icon with transformations and styling
FontAwesome icon = IFontAwesome.createIcon(FontAwesomeIcons.cogs, FontAwesomeStyles.Regular);
icon.spin()
.transform(FontAwesomeTransforms.Grow_3, FontAwesomeTransforms.Up_4)
.setStyle(FontAwesomeStyles.Regular)
.setSize(FontAwesomeSizes.$4x)
.setIcon(FontAwesomeIcons.cogs);import com.jwebmp.plugins.fontawesome5.IFontAwesome;
// Create a masked icon (icon inside another icon)
FontAwesome maskedIcon = IFontAwesome.createMaskIcon(
FontAwesomeIcons.cog, FontAwesomeStyles.Light,
FontAwesomeIcons.comment_alt, FontAwesomeStyles.Regular
);import com.jwebmp.plugins.fontawesome5.icons.FontAwesomeBrandIcons;
// Use brand icons
FontAwesome githubIcon = new FontAwesome(FontAwesomeStyles.Brand, FontAwesomeBrandIcons.github);
FontAwesome twitterIcon = new FontAwesome(FontAwesomeStyles.Brand, FontAwesomeBrandIcons.twitter);- Backend: Java 25 LTS, Maven, GuicedEE (IoC)
- Frontend: Angular 20, TypeScript, Font Awesome 7.2.0
- Integration: JWebMP Page Configurators, ServiceLoader SPI
- Rendering: SVG via angular-fontawesome or CSS Web Fonts
- Module System: JPMS with explicit dependencies
src/main/java/com/jwebmp/plugins/fontawesome5/
├── FontAwesome.java # Main icon component
├── IFontAwesome.java # Icon factory interface
├── FontAwesomeLayers.java # Icon layering container
├── FontAwesomeLayerText.java # Text in icon layers
├── FontAwesomeLayerCounter.java # Counter badges
├── FontAwesomeList.java # Icon lists
├── FontAwesomeSwapOnClick.java # Click-based icon swap
├── config/
│ ├── FontAwesome5PageConfigurator.java # Auto-configuration
│ ├── FontAwesomeConfigOptions.java # JS config options
│ └── FontAwesomeReferenceType.java # SVG vs WebFont enum
├── icons/
│ ├── FontAwesomeIcons.java # 6000+ icon enum
│ └── FontAwesomeBrandIcons.java # Brand icons enum
└── options/
├── FontAwesomeStyles.java # Icon styles (Solid, Regular, etc.)
├── FontAwesomeSizes.java # Size presets (xs to 10x)
├── FontAwesomeTransforms.java # Transformations (rotate, scale, etc.)
├── FontAwesomeFamily.java # Icon font families
└── FontAwesomeDisplayOptions.java # Display configuration
| Style | Description | Availability | Java Enum |
|---|---|---|---|
| Solid | Filled icons | Free | FontAwesomeStyles.Solid |
| Brand | Logo and brand icons | Free | FontAwesomeStyles.Brand |
| Classic | Classic style icons | Free | FontAwesomeStyles.Classic |
Note: Additional icon styles (Regular, Light, Duotone, Thin, Sharp) are available in the separate Font Awesome Pro plugin.
FontAwesomeSizes.xs // Extra small
FontAwesomeSizes.sm // Small
FontAwesomeSizes.lg // Large
FontAwesomeSizes.$1x // 1x size
FontAwesomeSizes.$2x // 2x size
FontAwesomeSizes.$3x // 3x size
FontAwesomeSizes.$4x // 4x size
FontAwesomeSizes.$5x // 5x size
FontAwesomeSizes.$6x // 6x size
FontAwesomeSizes.$7x // 7x size
FontAwesomeSizes.$8x // 8x size
FontAwesomeSizes.$9x // 9x size
FontAwesomeSizes.$10x // 10x size// Scaling
FontAwesomeTransforms.Grow_1 to Grow_16 // Grow icon
FontAwesomeTransforms.Shrink_1 to Shrink_16 // Shrink icon
// Positioning
FontAwesomeTransforms.Up_1 to Up_16 // Move up
FontAwesomeTransforms.Down_1 to Down_16 // Move down
FontAwesomeTransforms.Left_1 to Left_16 // Move left
FontAwesomeTransforms.Right_1 to Right_16 // Move right
// Rotation
FontAwesomeTransforms.Rotate_90 // Rotate 90 degrees
FontAwesomeTransforms.Rotate_180 // Rotate 180 degrees
FontAwesomeTransforms.Rotate_270 // Rotate 270 degrees
// Flipping
FontAwesomeTransforms.FlipHorizontal // Flip horizontally
FontAwesomeTransforms.FlipVertical // Flip vertically
FontAwesomeTransforms.FlipBoth // Flip both directionsMain icon component extending Italic<J>:
// Constructors
FontAwesome(FontAwesomeStyles style, IFontAwesomeIcon icon)
FontAwesome()
// Configuration Methods
J setStyle(FontAwesomeStyles style)
J setIcon(IFontAwesomeIcon icon)
J setSize(FontAwesomeSizes size)
J spin()
J pulse()
J transform(FontAwesomeTransforms... transforms)Factory methods for creating icons:
static FontAwesome createIcon(IFontAwesomeIcon icon, FontAwesomeStyles style)
static FontAwesome createMaskIcon(IFontAwesomeIcon foregroundIcon, FontAwesomeStyles foregroundStyle,
IFontAwesomeIcon backgroundIcon, FontAwesomeStyles backgroundStyle)Container for layered icons:
FontAwesomeLayers layers = new FontAwesomeLayers();
layers.add(icon1);
layers.add(icon2);
layers.add(new FontAwesomeLayerText("Text"));
layers.add(new FontAwesomeLayerCounter("5"));The plugin is automatically configured when present on the classpath:
@TsDependency(value = "@fortawesome/fontawesome-svg-core", version = "^7.2.0")
@TsDependency(value = "@fortawesome/free-solid-svg-icons", version = "^7.2.0")
@TsDependency(value = "@fortawesome/free-brands-svg-icons", version = "^6.2.2")
@TsDependency(value = "@fortawesome/angular-fontawesome", version = "^4.0.0")
@NgBootModuleImport("FontAwesomeModule")
public class FontAwesome5PageConfigurator implements IPageConfigurator {
// Auto-loaded via ServiceLoader SPI
}// Configure Font Awesome JavaScript behavior
FontAwesome5PageConfigurator.getConfigOptions()
.setKeepOriginalSource(true)
.setNestSVG();// Use SVG rendering (default, recommended)
FontAwesome5PageConfigurator.setFontAwesomeReferenceType(FontAwesomeReferenceType.SVG);
// Use CSS Web Font rendering (legacy)
FontAwesome5PageConfigurator.setFontAwesomeReferenceType(FontAwesomeReferenceType.WebFontCSS);mvn clean testmvn clean test jacoco:report
# Open: target/site/jacoco/index.htmlimport com.jwebmp.plugins.fontawesome5.FontAwesome;
import com.jwebmp.plugins.fontawesome5.icons.FontAwesomeIcons;
import com.jwebmp.plugins.fontawesome5.options.FontAwesomeStyles;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class FontAwesomeTest {
@Test
public void testIconCreation() {
FontAwesome icon = new FontAwesome(FontAwesomeStyles.Solid, FontAwesomeIcons.cog);
assertNotNull(icon);
assertEquals("fa-icon", icon.getTag());
}
@Test
public void testIconFactory() {
FontAwesome icon = IFontAwesome.createIcon(FontAwesomeIcons.user, FontAwesomeStyles.Solid);
assertNotNull(icon);
}
}com.jwebmp.plugins.fontawesome5
├── com.jwebmp.core (JWebMP core)
├── com.jwebmp.plugins.angular (Angular integration)
├── com.jwebmp.plugins.typescript.client (TypeScript generation)
└── jakarta.validation (Bean validation)
com.jwebmp.plugins.fontawesome5— Core Font Awesome componentscom.jwebmp.plugins.fontawesome5.config— Configuration and page configuratorscom.jwebmp.plugins.fontawesome5.icons— Icon enums (2000+ free icons)com.jwebmp.plugins.fontawesome5.options— Styles, sizes, transforms, display options
- Font Awesome 6 Docs — Official Font Awesome documentation
- Angular Font Awesome — Angular component library
- Icon Gallery — Browse 6000+ icons
- JWebMP Home — JWebMP framework documentation
| File | Purpose |
|---|---|
FontAwesome.java |
Main icon component |
IFontAwesome.java |
Factory interface for creating icons |
FontAwesomeIcons.java |
Enum with 2000+ free icon names |
FontAwesomeBrandIcons.java |
Brand and logo icons |
FontAwesome5PageConfigurator.java |
Auto-configuration |
pom.xml |
Maven build configuration |
module-info.java |
JPMS module descriptor |
public class NavigationBar extends Div<NavigationBar> {
public NavigationBar() {
super();
// Home icon
add(IFontAwesome.createIcon(FontAwesomeIcons.home, FontAwesomeStyles.Solid));
// User profile icon
add(IFontAwesome.createIcon(FontAwesomeIcons.user, FontAwesomeStyles.Solid));
// Settings icon
add(IFontAwesome.createIcon(FontAwesomeIcons.cog, FontAwesomeStyles.Solid));
}
}public class LoadingSpinner extends Div<LoadingSpinner> {
public LoadingSpinner() {
super();
FontAwesome spinner = IFontAwesome.createIcon(FontAwesomeIcons.spinner, FontAwesomeStyles.Solid);
spinner.spin().setSize(FontAwesomeSizes.$2x);
add(spinner);
}
}public class SocialLinks extends Div<SocialLinks> {
public SocialLinks() {
super();
add(new FontAwesome(FontAwesomeStyles.Brand, FontAwesomeBrandIcons.github));
add(new FontAwesome(FontAwesomeStyles.Brand, FontAwesomeBrandIcons.twitter));
add(new FontAwesome(FontAwesomeStyles.Brand, FontAwesomeBrandIcons.linkedin));
}
}public class NotificationIcon extends Div<NotificationIcon> {
public NotificationIcon(int count) {
super();
FontAwesomeLayers layers = new FontAwesomeLayers();
layers.add(IFontAwesome.createIcon(FontAwesomeIcons.bell, FontAwesomeStyles.Solid));
layers.add(new FontAwesomeLayerCounter(String.valueOf(count)));
add(layers);
}
}public class TransformedIcon extends Div<TransformedIcon> {
public TransformedIcon() {
super();
FontAwesome icon = IFontAwesome.createIcon(FontAwesomeIcons.arrow_right, FontAwesomeStyles.Solid);
icon.transform(FontAwesomeTransforms.Rotate_90, FontAwesomeTransforms.Grow_2);
add(icon);
}
}This project takes security seriously.
Key Security Features:
- No external network calls (icons loaded from NPM packages)
- No secrets or credentials required (except Pro token for Pro features)
- SVG sanitization via angular-fontawesome
- OWASP Dependency-Check in CI/CD
- GitHub Dependabot enabled
- JSpecify null-safety annotations
Pro Token Security:
- Use the page configurator to configure the Pro token securely at application startup, preferably from environment variables
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit with clear messages (
git commit -m "feat: add new icon transformation") - Push to your fork (
git push origin feature/my-feature) - Open a Pull Request
- Java: Follow JWebMP conventions (enum naming, proper null safety)
- Tests: JUnit 5, ≥80% coverage (Jacoco enforced)
- Formatting: Maven Spotless plugin enforced
- Documentation: Update README for new features
| Aspect | Status |
|---|---|
| Version | 7.2.0 / 2.0.0-SNAPSHOT |
| Icons | 2000+ Free |
| Java | 25 LTS (required) |
| Build | Passing |
| License | Apache 2.0 |
| Maintenance | Active |
- GitHub Repository: https://github.com/JWebMP/JWebMP
- Maven Central: https://mvnrepository.com/artifact/com.jwebmp.plugins/font-awesome
- Font Awesome Home: https://fontawesome.com/
- Icon Gallery: https://fontawesome.com/icons
- Angular Font Awesome: https://github.com/FortAwesome/angular-fontawesome
- JWebMP Home: https://jwebmp.com/
Licensed under the Apache License 2.0.
Copyright 2025 JWebMP Contributors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
- Font Awesome — The iconic SVG, font, and CSS framework
- Angular Font Awesome — Official Angular component
- JWebMP — Server-driven web framework
- Angular — Modern web framework
- GitHub Issues: https://github.com/JWebMP/JWebMP/issues
- Discussions: https://github.com/JWebMP/JWebMP/discussions
- Font Awesome Docs: https://fontawesome.com/docs
- Font Awesome Support: https://fontawesome.com/support
- Icon Search: https://fontawesome.com/icons
Made with JWebMP