Package org.patternfly.core


package org.patternfly.core
Core classes and interfaces for PatternFly Java.

This package provides the foundational building blocks used throughout PatternFly Java components and layouts. It includes utilities for ARIA attributes, data attributes, component context management, observable values, and common types.

Key Classes and Interfaces

ARIA and Data Attributes

  • Aria - Constants for ARIA attribute names (aria-label, aria-expanded, etc.)
  • Attributes - Common HTML attribute constants
  • Dataset - Constants for data-* attribute names used in PatternFly components
  • Roles - Constants for ARIA role attribute values
  • Ouia - Open UI Automation (OUIA) data attribute utilities for testing
  • OuiaSupport - Mixin interface for custom components to participate in OUIA

Component Infrastructure

Utilities

  • Tuple and Tuples - Simple key-value pair types
  • Numbers - Numeric utility functions
  • Timeouts - Common timeout constants
  • Validation - Validation helpers for property ranges and enums
  • LanguageDirection - Language direction enumeration (LTR/RTL)
  • Version - Version information for the PatternFly Java library

Integration with Elemento

PatternFly Java builds upon Elemento's builder API, providing a fluent, type-safe approach to creating web components. The ComponentContext interface extends Elemento's TypedBuilder to provide consistent builder patterns across all PatternFly components.

Observable Values

The ObservableValue class enables reactive programming patterns by allowing components to subscribe to value changes. Example usage:

 ObservableValue<String> value = ObservableValue.ov("initial");
 value.subscribe((current, previous) -> console.log("Value changed: " + current));
 value.set("new value"); // Triggers subscriber notification
See Also:
  • Class
    Description
    AddItemHandler<C extends HasItems<?,?,?>, S extends HasIdentifier<?,?>>
    A functional interface that defines a handler for adding items to components.
    Provides constants for common ARIA attribute names used across PatternFly components.
    Provides constants for common HTML attribute names used across PatternFly components.
    AurHandler<C extends HasItems<?,?,?>, S extends HasIdentifier<?,?>>
    A utility class for managing add, update, and remove event handlers for a component.
    ComponentContext<E extends elemental2.dom.Element, B extends TypedBuilder<E,B>>
    The ComponentContext interface represents a context for a component, providing methods to store and retrieve arbitrary values associated with keys.
    Provides constants for data-* attribute names used across PatternFly components.
    HasIdentifier<E extends elemental2.dom.Element, B extends TypedBuilder<E,B>>
    This interface represents a (sub)component that has an identifier.
    HasItems<E extends elemental2.dom.Element, C extends HasItems<E,C,S>, S extends HasIdentifier<? extends elemental2.dom.HTMLElement, ?>>
    The HasItems interface represents a component that can contain a collection of items.
    HasObservableValue<E extends elemental2.dom.Element, B extends TypedBuilder<E,B>, T>
    Interface for components that can bind to an ObservableValue and react to value changes.
    Interface for components that expose a typed value, such as form controls and inputs.
    Represents the text direction (left-to-right or right-to-left) of an element.
    Utility methods for numeric calculations such as percentage computation.
    Inspired by FrontendMasters/obervablish-values.
     
    Ordered<E extends elemental2.dom.Element, C extends HasItems<E,C,S>, S extends HasIdentifier<? extends elemental2.dom.HTMLElement, ?>>
    The Ordered interface maintains its elements in a specific order.
    Support for Open UI Automation.
    OuiaSupport<E extends elemental2.dom.HTMLElement, B extends TypedBuilder<E,B>>
    Interface for components that support Open UI Automation.
    RemoveItemHandler<C extends HasItems<?,?,?>, S extends HasIdentifier<?,?>>
    Functional interface for handling the removal of items from a component that contains a collection of items.
    Provides constants for WAI-ARIA role attribute values used across PatternFly components.
    Provides timeout constants (in milliseconds) used across PatternFly components.
    Tuple<K,V>
    An immutable key-value pair.
    Tuples<K,V>
    An ordered collection of Tuple instances with lookup by key or value.
    UpdateItemHandler<C extends HasItems<?,?,?>, S extends HasIdentifier<?,?>>
    A functional interface that defines a handler invoked when an item is updated in a component implementing HasItems.
    Utility methods for validating property values such as numeric ranges and enum memberships.