Class Dropdown

java.lang.Object
io.mindspice.simplypages.components.Dropdown

public class Dropdown extends Object
Builder for disclosure navigation markup with a native button and ordinary links/items. Load framework JS/CSS once in the host shell for click, keyboard and dismissal behavior. This is not an ARIA menu; custom items retain their native keyboard behavior.

Mutable and not thread-safe. Items and configuration are accumulated on this builder until build() is called.

  • Method Details

    • create

      public static Dropdown create(String triggerText)
      Creates a dropdown builder.
      Parameters:
      triggerText - visible trigger text
      Returns:
      new dropdown builder
    • addLink

      public Dropdown addLink(String text, String href)
      Appends an anchor item with an application-controlled or separately navigation-validated href. Attribute encoding is applied, but Link's scheme policy is not.
      Parameters:
      text - link text
      href - link href
      Returns:
      this dropdown builder
    • addItem

      public Dropdown addItem(Component component)
      Appends a custom menu item component.
      Parameters:
      component - menu item component
      Returns:
      this dropdown builder
    • addDivider

      public Dropdown addDivider()
      Appends a divider item.
      Returns:
      this dropdown builder
    • withClass

      public Dropdown withClass(String className)
      Sets additional container class token(s).
      Parameters:
      className - class token(s)
      Returns:
      this dropdown builder
    • withAlignment

      public Dropdown withAlignment(String alignment)
      Sets dropdown alignment token.
      Parameters:
      alignment - expected tokens: left, right, or center
      Returns:
      this dropdown builder
    • build

      public Component build()
      Builds and returns a static dropdown component tree.
      Returns:
      root dropdown component