Class AccordionModule

All Implemented Interfaces:
Component

public class AccordionModule extends Module
Module for collapsible accordion sections.

Mutability and thread-safety: mutable and not thread-safe. Item expansion flags are mutable and applied during build; mutate within a request-scoped flow. For reuse, stop mutating and render as a stable structure with per-request slot/context values.

  • Constructor Details

    • AccordionModule

      public AccordionModule()
  • Method Details

    • create

      public static AccordionModule create()
    • withTitle

      public AccordionModule withTitle(String title)
      Description copied from class: Module
      Sets optional title consumed by Module.buildContent() implementations.
      Overrides:
      withTitle in class Module
    • withModuleId

      public AccordionModule withModuleId(String moduleId)
      Description copied from class: Module
      Sets module id and synchronizes the underlying id attribute.
      Overrides:
      withModuleId in class Module
    • addItem

      public AccordionModule addItem(String header, String content)
      Adds an accordion item with header and text content.
      Parameters:
      header - the accordion item header
      content - the content to display when expanded
    • addItem

      public AccordionModule addItem(String header, Component content)
      Adds an accordion item with header and custom component content.
      Parameters:
      header - the accordion item header
      content - custom component to display when expanded
    • withFirstExpanded

      public AccordionModule withFirstExpanded()
      Expands the first accordion item by default.
    • allowMultiple

      public AccordionModule allowMultiple()
      Allows multiple accordion items to be open simultaneously. By default, only one item can be open at a time.
    • buildContent

      protected void buildContent()
      Description copied from class: Module
      Composes module structure.

      Called at most once by Module.build() unless Module.rebuildContent() is invoked. Do not rely on this method for per-request mutation.

      Specified by:
      buildContent in class Module