Package org.patternfly.component.accordion


package org.patternfly.component.accordion
Provides the PatternFly accordion component for displaying collapsible content panels.

An accordion is used to deliver a large amount of content in a small space through progressive disclosure. The user gets key details about the underlying content and can choose to expand individual sections to get more detail.

Usage

Single expand accordion where only one item can be open at a time:

Accordion accordion = accordion().singleExpand()
    .addItem(accordionItem("item-1", "First item")
        .add(p().text("Content for first item")))
    .addItem(accordionItem("item-2", "Second item")
        .add(p().text("Content for second item")))
    .addItem(accordionItem("item-3", "Third item")
        .add(p().text("Content for third item")));

Bordered accordion with multiple body sections:

Accordion accordion = accordion().singleExpand().bordered()
    .addItem(accordionItem("item-1", "First item")
        .addBody(accordionItemBody()
            .add(p().text("First body section")))
        .addBody(accordionItemBody()
            .add(button().text("Call to action").link().inline())));
See Also:
  • Class
    Description
    An accordion is an interactive container that expands and collapses to hide or reveal nested content.
    Represents an item within an accordion component.