PatternFly Java's Its goal is to provide an easy-to-use, elegant, and efficient API to build complex web applications with PatternFly in Java. PatternFly Java integrates with and builds upon Elemento's builder API. It works with both GWT and J2CL.
PatternFly Java integrates with and builds upon Elemento's builder API. Static factory methods are used to create the components, and public instance methods add child elements and modify the component.
These methods are used to create a component. They are usually named after the component, are overloaded to accept required and optional arguments, and return an instance of the newly created component:
Button button1 = button("Click me!");
Button button2 = button("PatternFly", "https://www.patternfly.org");
These methods add subcomponents to a main component. They are usually called add<SubComponent>()
and return the main component so that the method call can be chained with other methods:
Dropdown dropdown = dropdown()
.addToggle(menuToggle("Dropdown"))
.addMenu(menu()
.addContent(menuContent()
.addList(menuList()
.addItem(actionMenuItem("item-0", "Action")))));
These methods modify the current component. They return the current component so that the method call can be chained with other methods:
Card card = card()
.flat()
.rounded()
.large();
These methods set ARIA-related attributes in the component. They're usually named aria<Attribute>()
and return the component so that the method call can be chained with other methods:
Navigation navigation = navigation(flat)
.ariaScrollBackLabel("� back")
.ariaScrollForwardLabel("� forward");
These methods add event handlers for various events to the component. They are usually named
on<Event>(), accept an event handler, and return the component so that the method call can be
chained with other methods. PatternFly Java defines some
{@linkplain org.patternfly.handler common event handlers} that are reused in all components.
Drawer drawer = drawer().id("drw")
.onToggle((e, c, expanded) -> console.log("Drawer expanded: " + expanded));
Common behavior across all components is implemented by base classes and interfaces. All components extend from either {@link org.patternfly.component.BaseComponent} or {@link org.patternfly.component.BaseComponentSVG}. These base classes implement interfaces from Elemento to manipulate the component element.
In addition, components implement these interfaces to provide a common API:
card().plain() toggles the
plain flag of the card component and is defined in the {@link org.patternfly.style.Modifiers.Plain}
interface.
PatternFly Java consists of these Maven modules (a-z):

| Module | Description |
|---|---|
| patternfly-java-bom | Bill of materials |
| patternfly-java-codeeditor | PatternFly codeeditor |
| patternfly-java-components | PatternFly components |
| patternfly-java-core | Core PatternFly Java classes |
| patternfly-java-finder | PatternFly Java Finder extension |
| patternfly-java-gwt | PatternFly Java for GWT |
| patternfly-java-icons | PatternFly Java icons |
| patternfly-java-j2cl | PatternFly Java for J2CL |
| patternfly-java-layouts | PatternFly Java layouts |