Class TextInput


public class TextInput extends ActionComponent
A modal-only text input field
See Also:
  • Method Details

    • small

      public static TextInput small(String customId)
      Creates a short button.
      Parameters:
      customId - A developer-defined identifier for the button.
      Returns:
      A button with the given data.
    • small

      public static TextInput small(String customId, String label)
      Creates a short button.
      Parameters:
      customId - A developer-defined identifier for the button.
      label - The text that appears above the input
      Returns:
      A button with the given data.
    • small

      public static TextInput small(String customId, String label, String placeholder)
      Creates a short button.
      Parameters:
      customId - A developer-defined identifier for the button.
      label - The text that appears above the input
      placeholder - The placeholder text to be displayed
      Returns:
      A button with the given data.
    • small

      public static TextInput small(String customId, String label, int minLength, int maxLength)
      Creates a short button.
      Parameters:
      customId - A developer-defined identifier for the button.
      label - The text that appears above the input
      minLength - The minimum length the user is required to input
      maxLength - The maximum length the user is required to input
      Returns:
      A button with the given data.
    • paragraph

      public static TextInput paragraph(String customId)
      Creates a paragraph button.
      Parameters:
      customId - A developer-defined identifier for the button.
      Returns:
      A button with the given data.
    • paragraph

      public static TextInput paragraph(String customId, String label)
      Creates a paragraph button.
      Parameters:
      customId - A developer-defined identifier for the button.
      label - The text that appears above the input
      Returns:
      A button with the given data.
    • paragraph

      public static TextInput paragraph(String customId, String label, String placeholder)
      Creates a paragraph button.
      Parameters:
      customId - A developer-defined identifier for the button.
      label - The text that appears above the input
      placeholder - The placeholder text to display
      Returns:
      A button with the given data.
    • paragraph

      public static TextInput paragraph(String customId, String label, int minLength, int maxLength)
      Creates a paragraph button.
      Parameters:
      customId - A developer-defined identifier for the button.
      label - The text that appears above the input
      minLength - The minimum length the user is required to input
      maxLength - The maximum length the user is required to input
      Returns:
      A button with the given data.
    • getStyle

      public TextInput.Style getStyle()
      Gets the text input's style.
      Returns:
      the style of the text input
    • getCustomId

      public String getCustomId()
      Gets the text input's custom id.
      Returns:
      the custom id of the text input
    • getLabel

      public Optional<String> getLabel()
      Gets the text input's label
      Returns:
      The text input's label
    • getMinLength

      public int getMinLength()
      Gets the text input's minimum length requirement. If not present, defaults to 0.
      Returns:
      The text input's minimum length
    • getMaxLength

      public int getMaxLength()
      Gets the text input's maximum length requirement. If not present, defaults to 4000
      Returns:
      The text input's maximum length
    • isRequired

      public boolean isRequired()
      Gets whether the text input is required to be filled. Defaults to true
      Returns:
      Whether the text input is required
    • getValue

      public Optional<String> getValue()
      Gets text input's value, if any.
      Returns:
      The text input's value
    • getPlaceholder

      public Optional<String> getPlaceholder()
      Gets the text input's placeholder text, if any.
      Returns:
      The text input's placeholder
    • required

      public TextInput required()
      Creates a new text input with the same data as this one, but required.
      Returns:
      A new required text input with the same data as this one.
    • required

      public TextInput required(boolean value)
      Creates a new text input with the same data as this one, but depending on the value param it may be required or not.
      Parameters:
      value - True if the text input should be required otherwise False.
      Returns:
      A new possibly required button with the same data as this one.
    • prefilled

      public TextInput prefilled(String value)
      Creates a new text input with the same data as this, but with a pre-filled value.
      Parameters:
      value - The pre-filled text value
      Returns:
      A new text input with the same data as this one.
    • placeholder

      public TextInput placeholder(String value)
      Creates a new text input with the same data as this, but with placeholder text.
      Parameters:
      value - The placeholder text value
      Returns:
      A new text input with the same data as this one.