All pages
Powered by GitBook
1 of 1

Dropdown option

Example

TODO: Redo Kotlin example with Kotlin DSL for enumerables and dropdowns

Using an integer index

@Dropdown(
    title = "My Dropdown",
    description = "This is my dropdown", // Recommended, default = ""
    icon = "/my_dropdown.svg", // Optional, default = ""
    category = "Dropdowns", // Recommended, default = "General"
    subcategory = "General" // Recommended, default = "General"
    options = { "HELLO", "WORLD", "ONECONFIG" } // Recommended, default = {}
)
public static int myDropdown = 0; // 0 = "HELLO"
@Dropdown(
    title = "My Dropdown",
    description = "This is my dropdown", // Recommended, default = ""
    icon = "/my_dropdown.svg", // Optional, default = ""
    category = "Dropdowns", // Recommended, default = "General"
    subcategory = "General" // Recommended, default = "General"
    options = ["HELLO", "WORLD", "ONECONFIG"] // Recommended, default = []
)
var myDropdown = 0 // 0 = "HELLO"

Using a custom enum class

public enum MyDropdownOptions {
    HELLO,
    WORLD,
    ONECONFIG;
}

@Dropdown(
    title = "My Dropdown",
    description = "This is my dropdown", // Recommended, default = ""
    icon = "/my_dropdown.svg", // Optional, default = ""
    category = "Dropdowns", // Recommended, default = "General"
    subcategory = "General" // Recommended, default = "General"
    // We can't use the options field when using an enum.
)
public static MyDropdownOptions myDropdown = MyDropdownOptions.HELLO;
enum class MyDropdownOptions {
    HELLO,
    WORLD,
    ONECONFIG
}

@Dropdown(
    title = "My Dropdown",
    description = "This is my dropdown", // Recommended, default = ""
    icon = "/my_dropdown.svg", // Optional, default = ""
    category = "Dropdowns", // Recommended, default = "General"
    subcategory = "General" // Recommended, default = "General"
    // We can't use the options field when using an enum.
)
var myDropdown = MyDropdownOptions.HELLO