Enum ButtonStyle
- java.lang.Object
-
- java.lang.Enum<ButtonStyle>
-
- net.dv8tion.jda.api.interactions.components.ButtonStyle
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ButtonStyle>
public enum ButtonStyle extends java.lang.Enum<ButtonStyle>
The available styles used forButtons.
A button can have different styles to indicate its purpose.To see what each button looks like here is an example cheatsheet:

-
-
Enum Constant Summary
Enum Constants Enum Constant Description DANGERDanger/Deny button style, usually in red.LINKLink button style, usually in gray and has a link attachedPRIMARYPrimary button style, usually in blue.SECONDARYSecondary button style, usually in gray.SUCCESSSuccess/Approve button style, usually in green.UNKNOWNPlaceholder for future styles
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ButtonStylefromKey(int key)Returns the style associated with the provided keyintgetKey()The raw style integer keystatic ButtonStylevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ButtonStyle[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
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), useDANGER.
-
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.
-
LINK
public static final ButtonStyle LINK
Link button style, usually in gray and has a link attached
-
-
Method Detail
-
values
public static ButtonStyle[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ButtonStyle c : ButtonStyle.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ButtonStyle valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.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
-
-