Package org.patternfly.component.content


package org.patternfly.component.content
Provides the PatternFly content component for rendering styled text elements such as headings, paragraphs, and lists.

The content component is used to wrap text content with PatternFly styling. It can act as a wrapper around standard HTML elements or render specific content types like headings (h1-h6) and paragraphs. When used as a wrapper, nested HTML elements automatically receive PatternFly typography styles.

Usage

Content used as a wrapper for headings:
import static org.patternfly.component.content.Content.content;
import static org.patternfly.component.content.ContentType.h1;
import static org.patternfly.component.content.ContentType.h2;
import static org.patternfly.component.content.ContentType.h3;

content()
        .add(content(h1).text("Hello World"))
        .add(content(h2).text("Second Level"))
        .add(content(h3).text("Third Level"));
Content as a wrapper for standard HTML elements:
import static org.jboss.elemento.Elements.p;
import static org.patternfly.component.content.Content.content;
import static org.patternfly.component.content.ContentType.p;

content()
        .add(content(p).text("Content component renders with PatternFly styles."))
        .add(p().text("HTML elements within a wrapping Content are styled as well!"));
See Also:
  • Class
    Description
    A content component contains a block of styled HTML content.