# Radio button option

<figure><img src="https://455339379-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMEjGl1BGNegPgKE0wK4Y%2Fuploads%2FunX4UyCgMo4RBAcjVZ7N%2Fjava_qLmE0Cnfa7.png?alt=media&#x26;token=e8d60458-18a5-48a7-84d4-68356db2bd09" alt=""><figcaption><p>An example of what the radio button looks like in-game.</p></figcaption></figure>

## Example

## TODO: Redo Kotlin example with Kotlin DSL for enumerables and radiobuttons

### Using an integer index

{% tabs %}
{% tab title="Java" %}

```java
@RadioButton(
    title = "My Radio",
    description = "This is my radio", // Recommended, default = ""
    icon = "/my_radio.svg", // Optional, default = ""
    category = "Radio Buttons", // Recommended, default = "General"
    subcategory = "General", // Recommended, default = "General"
    options = { "HELLO", "WORLD", "ONECONFIG" } // Recommended, default = {}
)
public static int myRadio = 0; // 0 = "HELLO"
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
@RadioButton(
    title = "My Radio",
    description = "This is my radio", // Recommended, default = ""
    icon = "/my_radio.svg", // Optional, default = ""
    category = "Radio Buttons", // Recommended, default = "General"
    subcategory = "General", // Recommended, default = "General"
    options = ["HELLO", "WORLD", "ONECONFIG"] // Recommended, default = []
)
var myRadio = 0 // 0 = "HELLO"
```

{% endtab %}
{% endtabs %}

### Using a custom enum class

{% tabs %}
{% tab title="Java" %}

```java
public enum MyRadioOptions {
    HELLO,
    WORLD,
    ONECONFIG;
}

@RadioButton(
    title = "My Radio",
    description = "This is my radio", // Recommended, default = ""
    icon = "/my_radio.svg", // Optional, default = ""
    category = "Radio Buttons", // Recommended, default = "General"
    subcategory = "General", // Recommended, default = "General"
    // this field cannot be present when using an enum: options = { "HELLO", "WORLD", "ONECONFIG" }
)
public static MyRadioOptions myRadio = MyRadioOptions.HELLO;
```

{% endtab %}

{% tab title="Kotlin" %}

```kotlin
public enum class MyRadioOptions {
    HELLO,
    WORLD,
    ONECONFIG
}

@RadioButton(
    title = "My Radio",
    description = "This is my radio", // Recommended, default = ""
    icon = "/my_radio.svg", // Optional, default = ""
    category = "Radio Buttons", // Recommended, default = "General"
    subcategory = "General", // Recommended, default = "General"
    // this field cannot be present when using an enum: options = ["HELLO", "WORLD", "ONECONFIG"]
)
var myRadio = MyRadioOptions.HELLO
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Your field can be typed with an integer, or with an enum.

When using an integer, you NEED to provide the `options` property, otherwise it is not supported when using an enum.
{% endhint %}
