Interface ListBuilder

All Superinterfaces:
BaseBuilder<ListBuilder>
All Known Implementing Classes:
DefaultListBuilder

public interface ListBuilder extends BaseBuilder<ListBuilder>
Builder for list prompts.
  • Method Details

    • newItem

      ListBuilder newItem(String id)
      Create a new item with the given ID.
      Parameters:
      id - the ID
      Returns:
      this builder
    • text

      ListBuilder text(String text)
      Set the text for the current item.
      Parameters:
      text - the text
      Returns:
      this builder
    • disabled

      ListBuilder disabled(boolean disabled)
      Set whether the current item is disabled.
      Parameters:
      disabled - whether the item is disabled
      Returns:
      this builder
    • disabledText

      ListBuilder disabledText(String disabledText)
      Set the disabled text for the current item.
      Parameters:
      disabledText - the disabled text
      Returns:
      this builder
    • footer

      default ListBuilder footer(String footer)
      Set the footer text for the current item. The footer is shown dimmed below the list while this item is focused. Newlines split it into multiple lines and long lines wrap to the terminal width; the footer pane has a fixed height so the list does not shift between items.
      Parameters:
      footer - the footer text, or null/empty for none
      Returns:
      this builder
    • add

      Add the current item to the list.
      Returns:
      this builder
    • add

      default ListBuilder add(String name, String text)
      Convenience method to add a simple list item with name and text.
      Parameters:
      name - the item name/id
      text - the display text
      Returns:
      this builder
    • add

      default ListBuilder add(String name, String text, boolean disabled)
      Convenience method to add a simple list item with name, text, and disabled state.
      Parameters:
      name - the item name/id
      text - the display text
      disabled - whether the item is disabled
      Returns:
      this builder
    • add

      default ListBuilder add(String name, String text, boolean disabled, String disabledText)
      Convenience method to add a simple list item with name, text, disabled state, and disabled text.
      Parameters:
      name - the item name/id
      text - the display text
      disabled - whether the item is disabled
      disabledText - the text to show when disabled
      Returns:
      this builder
    • filterable

      ListBuilder filterable(boolean filterable)
      Set whether the list supports inline text filtering. When enabled (the default), the user can type characters to filter the displayed items. When disabled, typed characters are ignored.
      Parameters:
      filterable - true to enable filtering, false to disable
      Returns:
      this builder
    • pageSize

      ListBuilder pageSize(int pageSize)
      Set the page size for pagination.
      Parameters:
      pageSize - the page size, or 0 for no pagination
      Returns:
      this builder
    • showPageIndicator

      ListBuilder showPageIndicator(boolean showPageIndicator)
      Set whether to show page indicators.
      Parameters:
      showPageIndicator - true to show page indicators
      Returns:
      this builder
    • newSeparator

      ListSeparatorBuilder newSeparator()
      Create a new separator with no text.
      Returns:
      a separator builder
    • newSeparator

      ListSeparatorBuilder newSeparator(String text)
      Create a new separator with the given text.
      Parameters:
      text - the separator text
      Returns:
      a separator builder