Class Details<T extends Details<T>>


public class Details<T extends Details<T>> extends StyledContainerElement<T>
Represents an HTML <details> element for collapsible content.

The Details element creates a disclosure widget in which information is visible only when toggled into an "open" state. A Summary element provides a heading or summary for the details content.

Features:

  • Interactive collapsible/expandable content
  • Should contain a summary element
  • Can be initially open or closed
  • Built-in browser functionality
  • Improves content organization

Usage:


 Details details = new Details();
 details.addChild(new Summary("Click to expand"));
 details.addChild(new Paragraph("Hidden content here"));
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Summary
  • invalid reference
    StyledElement
  • Constructor Details

    • Details

      public Details()
      Constructs a <details> element in closed state.
    • Details

      public Details(boolean open)
      Constructs a <details> element with specified open state.
      Parameters:
      open - true to show content initially, false to hide it
  • Method Details

    • setName

      public final T setName(String name)
      Sets the name attribute for this details element.

      When multiple <details> elements share the same name, they form an exclusive accordion group where only one can be open at a time.

      Parameters:
      name - The name for accordion grouping.
      Returns:
      This element for method chaining.
    • setOpen

      public final T setOpen(boolean open)
      Sets whether the details content is visible.

      When true, the disclosure widget is expanded and the content is visible. When false, only the summary is visible.

      Parameters:
      open - True to expand the content, false to collapse.
      Returns:
      This element for method chaining.