Package org.patternfly.component.expandable


package org.patternfly.component.expandable
Provides the PatternFly expandable section component and its subcomponents for toggling the visibility of content.

An expandable section is used to hide and show content using a toggle. It supports dynamic toggle text, disclosure and indented variations, detached layout, truncation of long content, and custom toggle content with icons or badges.

Usage

A basic expandable section with dynamic toggle text:
import static org.patternfly.component.expandable.ExpandableSection.expandableSection;
import static org.patternfly.component.expandable.ExpandableSectionContent.expandableSectionContent;
import static org.patternfly.component.expandable.ExpandableSectionToggle.expandableSectionToggle;

expandableSection()
        .addToggle(expandableSectionToggle("Show more", "Show less"))
        .addContent(expandableSectionContent()
                .text("This content is visible only when the component is expanded."));
An expandable section with truncation for long content:
import static org.patternfly.component.expandable.ExpandableSection.expandableSection;
import static org.patternfly.component.expandable.ExpandableSectionContent.expandableSectionContent;
import static org.patternfly.component.expandable.ExpandableSectionToggle.expandableSectionToggle;

expandableSection()
        .truncate(2)
        .addContent(expandableSectionContent()
                .text("Long content that will be truncated to 2 lines..."))
        .addToggle(expandableSectionToggle("Show more", "Show less"));
See Also: