java.lang.Object
java.lang.Enum<ButtonStyle>
net.dv8tion.jda.api.interactions.components.buttons.ButtonStyle
All Implemented Interfaces:
Serializable, Comparable<ButtonStyle>

public enum ButtonStyle extends Enum<ButtonStyle>
The available styles used for Buttons.
A button can have different styles to indicate its purpose.

To see what each button looks like here is an example cheatsheet:
ButtonExample

  • Enum Constant Details

    • UNKNOWN

      public static final ButtonStyle UNKNOWN
      Placeholder for future styles
    • PRIMARY

      public static final ButtonStyle PRIMARY
      Primary button style, usually in blue. Often used as the accept, submit, or acknowledge button. For confirm buttons (destructive action), use DANGER.
    • SECONDARY

      public static final ButtonStyle SECONDARY
      Secondary button style, usually in gray. Often used as the cancel or lesser used option.
    • SUCCESS

      public static final ButtonStyle SUCCESS
      Success/Approve button style, usually in green. This should be used to indicate a positive action.
    • DANGER

      public static final ButtonStyle DANGER
      Danger/Deny button style, usually in red. This button should be used to indicate destructive actions.
  • Method Details

    • values

      public static ButtonStyle[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static ButtonStyle valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • getKey

      public int getKey()
      The raw style integer key
      Returns:
      The raw style key
    • fromKey

      @Nonnull public static ButtonStyle fromKey(int key)
      Returns the style associated with the provided key
      Parameters:
      key - The key to convert
      Returns:
      The button style or UNKNOWN