This page covers the patternfly-java-icons Maven module: its generated Java classes, the Node.js-based code generation pipeline, and how components consume icons. For the general build pipeline that runs this generation step, see Build Pipeline. For the analogous token generation system, see Design Tokens System.
The patternfly-java-icons module (icons/) is a self-contained Maven module that provides all icon definitions used across the component library. It depends on patternfly-java-core and is in turn consumed by patternfly-java-components.
Module artifact: org.patternfly:patternfly-java-icons
Packaging: gwt-lib
GWT module name: org.patternfly.Icons
The two key generated files in this module are:
| File | Package | Purpose |
|---|---|---|
IconSets.java | org.patternfly.icon | Static factory methods grouped by icon set |
IconSpecs.java | org.patternfly.icon | Raw SVG path data for each icon |
Both files are excluded from license checks and Checkstyle enforcement pom.xml223-224 because they are generated artifacts and should not be edited by hand.
Sources: icons/pom.xml1-104 pom.xml223-224 pom.xml243-244
Four icon families are bundled. Each corresponds to a nested class inside IconSets:
| Nested class | npm package | Icon family |
|---|---|---|
IconSets.fas | @fortawesome/free-solid-svg-icons v5 | FontAwesome Solid |
IconSets.far | @fortawesome/free-regular-svg-icons v5 | FontAwesome Regular |
IconSets.fab | @fortawesome/free-brands-svg-icons v5 | FontAwesome Brands |
IconSets.patternfly | @patternfly/react-icons | PatternFly Icons |
Icons are accessed using static imports on the nested class:
Each static method (e.g. book(), cube(), key()) returns a fresh PredefinedIcon instance.
Sources: icons/package.json1-17 README.md213-253
Sources: icons/pom.xml59-94 icons/package.json1-17
The frontend-maven-plugin in icons/pom.xml drives three sequential executions during the generate-sources phase icons/pom.xml59-94:
install-node-and-npm — Downloads the pinned Node.js version (v24.10.0).yarn-install (npm install) — Installs all devDependencies from icons/package.json.generate-icon-specs — Runs npm run generate, which executes icons/src/scripts/generate.mjs.The script reads SVG definitions from the FontAwesome and PatternFly npm packages, converts icon names to camelCase Java identifiers, and writes out IconSpecs.java and IconSets.java.
Sources: icons/pom.xml59-103 icons/package.json5-6
PredefinedIcon ClassPredefinedIcon (in org.patternfly.icon) is the return type of every factory method in IconSets. It acts as an SVG builder — it wraps the SVG element representing the icon and exposes methods for customization.
Key characteristics:
PredefinedIcon.predefinedIcon(String iconName) (added in v0.4.3) allows constructing an icon by name string, as an alternative to importing the typed static factory.Sources: README.md221-222 CHANGELOG.md155-157 CHANGELOG.md439-440
WithIcon and WithIconAndText InterfacesComponents that accept icons implement one of two interfaces:
| Interface | Location | Purpose |
|---|---|---|
WithIcon | org.patternfly.component | Component accepts an icon only |
WithIconAndText | org.patternfly.component | Component accepts both an icon and text |
These interfaces define a common API (e.g. an icon(PredefinedIcon) method) so that all icon-capable components behave uniformly. An IconPosition enum controls whether the icon appears before (start) or after (end) the text.
Sources: README.md221-253 CHANGELOG.md547-549
Sources: README.md226-252
The patternfly-java-icons module sits between core and components in the dependency chain. All components that need icons pull in this module transitively.
Sources: icons/pom.xml35-40 components/pom.xml35-52 gwt/pom.xml47-67 j2cl/pom.xml35-44
| File | Role |
|---|---|
icons/pom.xml | Maven module definition; drives npm install and code generation |
icons/package.json | npm dependencies and generate script entry point |
icons/src/scripts/generate.mjs | Node.js script that reads npm icon packages and emits Java source |
icons/src/main/java/org/patternfly/icon/IconSets.java | Generated. Nested static classes fas, far, fab, patternfly with factory methods |
icons/src/main/java/org/patternfly/icon/IconSpecs.java | Generated. Raw SVG path data per icon |
icons/src/main/java/org/patternfly/icon/PredefinedIcon.java | Hand-written SVG builder wrapping icon data |
Sources: icons/pom.xml42-57 pom.xml223-224
Refresh this wiki