Class Accordion

java.lang.Object
org.patternfly.component.BaseComponent<elemental2.dom.HTMLElement, Accordion>
org.patternfly.component.accordion.Accordion
All Implemented Interfaces:
Iterable<AccordionItem>, Attachable, ElementAttributeMethods<elemental2.dom.HTMLElement, Accordion>, ElementClassListMethods<elemental2.dom.HTMLElement, Accordion>, ElementConsumerMethods<elemental2.dom.HTMLElement, Accordion>, ElementContainerMethods<elemental2.dom.HTMLElement, Accordion>, ElementEventMethods<elemental2.dom.HTMLElement, Accordion>, ElementIdMethods<elemental2.dom.HTMLElement, Accordion>, ElementQueryMethods<elemental2.dom.HTMLElement>, HTMLElementAttributeMethods<elemental2.dom.HTMLElement, Accordion>, HTMLElementDataMethods<elemental2.dom.HTMLElement, Accordion>, HTMLElementStyleMethods<elemental2.dom.HTMLElement, Accordion>, HTMLElementVisibilityMethods<elemental2.dom.HTMLElement, Accordion>, IsElement<elemental2.dom.HTMLElement>, TypedBuilder<elemental2.dom.HTMLElement, Accordion>, Component, HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>, OuiaSupport<elemental2.dom.HTMLElement, Accordion>, Modifiers.Bordered<elemental2.dom.HTMLElement, Accordion>, Modifiers.NoPlainOnGlass<elemental2.dom.HTMLElement, Accordion>, Modifiers.Plain<elemental2.dom.HTMLElement, Accordion>

public class Accordion extends BaseComponent<elemental2.dom.HTMLElement, Accordion> implements Attachable, Modifiers.Bordered<elemental2.dom.HTMLElement, Accordion>, HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>, Modifiers.NoPlainOnGlass<elemental2.dom.HTMLElement, Accordion>, Modifiers.Plain<elemental2.dom.HTMLElement, Accordion>
An accordion is an interactive container that expands and collapses to hide or reveal nested content. It takes advantage of progressive disclosure to help reduce page scrolling by allowing users to choose whether they want to show or hide more detailed information as needed.
See Also:
  • Method Details

    • accordion

      public static Accordion accordion()
      Creates a new Accordion instance backed by a <dl/>.
    • accordion

      public static Accordion accordion(AccordionType type)
    • attach

      public void attach(elemental2.dom.MutationRecord mutationRecord)
      Specified by:
      attach in interface Attachable
    • add

      public Accordion add(AccordionItem item)
      Description copied from interface: HasItems
      Adds an item to the component.
      Specified by:
      add in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      item - the item to be added to the component
      Returns:
      the builder instance after the item has been added
    • fixed

      public Accordion fixed()
      Same as fixed(true)
    • fixed

      public Accordion fixed(boolean fixed)
      Flag to indicate Accordion content is fixed
    • large

      public Accordion large()
      Same as large(true)
    • large

      public Accordion large(boolean large)
      Adds/removes modifier(large, lg)
    • singleExpand

      public Accordion singleExpand()
    • singleExpand

      public Accordion singleExpand(boolean singleExpand)
      Whether only one AccordionItem can be expanded
    • headingLevel

      public Accordion headingLevel(int headingLevel)
    • iconPosition

      public Accordion iconPosition(IconPosition iconPosition)
    • that

      public Accordion that()
      Specified by:
      that in interface TypedBuilder<elemental2.dom.HTMLElement, Accordion>
    • onAdd

      Description copied from interface: HasItems
      Registers a callback to be invoked whenever a new item is added to the component.
      Specified by:
      onAdd in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      onAdd - a AddItemHandler that takes the builder instance and the item being added as arguments
      Returns:
      the builder instance after adding the callback
    • onUpdate

      public Accordion onUpdate(UpdateItemHandler<Accordion, AccordionItem> onUpdate)
      Description copied from interface: HasItems
      Registers a callback to be invoked whenever an item is updated in the component.
      Specified by:
      onUpdate in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      onUpdate - a UpdateItemHandler that takes the component, the previous state of the item, and the updated state of the item as arguments
      Returns:
      the builder instance after adding the callback
    • onRemove

      public Accordion onRemove(RemoveItemHandler<Accordion, AccordionItem> onRemove)
      Description copied from interface: HasItems
      Registers a callback to be invoked whenever an item is removed from the component.
      Specified by:
      onRemove in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      onRemove - a RemoveItemHandler that takes the component and the item being removed as arguments
      Returns:
      the builder instance after adding the callback
    • onToggle

      public Accordion onToggle(ToggleHandler<AccordionItem> toggleHandler)
    • collapse

      public void collapse(String identifier)
    • collapse

      public void collapse(String identifier, boolean fireEvent)
    • expand

      public void expand(String identifier)
    • expand

      public void expand(String identifier, boolean fireEvent)
    • iterator

      public Iterator<AccordionItem> iterator()
      Specified by:
      iterator in interface Iterable<AccordionItem>
    • size

      public int size()
      Description copied from interface: HasItems
      Retrieves the total number of items currently contained in the component.
      Specified by:
      size in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Returns:
      the number of items contained in the component
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: HasItems
      Checks whether the collection of items in the component is empty.
      Specified by:
      isEmpty in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Returns:
      true if the component contains no items; false otherwise
    • contains

      public boolean contains(String identifier)
      Description copied from interface: HasItems
      Checks whether the component contains an item associated with the given identifier.
      Specified by:
      contains in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      identifier - the identifier of the item to be checked
      Returns:
      true if the component contains an item associated with the provided identifier, false otherwise
    • item

      public AccordionItem item(String identifier)
      Description copied from interface: HasItems
      Retrieves the item associated with the specified identifier from the component.
      Specified by:
      item in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      identifier - the identifier of the item to be retrieved
      Returns:
      the item associated with the given identifier, or null if no item is found
    • updateItem

      public void updateItem(AccordionItem item)
      Description copied from interface: HasItems
      Updates an existing item in the component.
      Specified by:
      updateItem in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      item - the item to be updated
    • removeItem

      public void removeItem(String identifier)
      Description copied from interface: HasItems
      Removes an item from the component based on the provided identifier.
      Specified by:
      removeItem in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>
      Parameters:
      identifier - the identifier of the item to be removed
    • clear

      public void clear()
      Description copied from interface: HasItems
      Clears all items from the component. This method removes any existing items within the component, leaving it empty. Any associated or registered callbacks related to the removal of items may be invoked as part of this operation.
      Specified by:
      clear in interface HasItems<elemental2.dom.HTMLElement, Accordion, AccordionItem>