> For the complete documentation index, see [llms.txt](https://tanishisherewith.gitbook.io/dynamic-hud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tanishisherewith.gitbook.io/dynamic-hud/contextmenu/option-less-than-t-greater-than-class/runnable-option.md).

# Runnable Option

### Introduction

`RunnableOption` is a option class that encapsulates a task to be executed upon user interaction, specifically designed for actions that need to be triggered. This essentially acts as a boolean option but runs a task everytime the "boolean" is true.

### Constructor Parameters

The RunnableOption class has two constructors that takes the following parameters:

* One of the constructors uses the `BooleanPool` class to store and manage the Boolean values. This is when you don't want the hassle to create a new and unnecessary Boolean for every Runnable Option you create. This constructor does not contain the `getter` and `setter` variables.
* `name`: Display name for the option.
* `getter`: **Supplier** that checks if the task is currently considered active or running.
* `setter`: **Consumer** that updates the task's active state based on user interaction.&#x20;
* `task`: The **Runnable** task to be executed.

### Interactivity

* **Click**: Toggles the task's active state and runs the task if set to active.
* **Render**: Displays the option's name with a color change to indicate the active state.

### Example Usage

```java
RunnableOption resetOption = new RunnableOption(
    "Reset",
    () -> this.isDefaultValue(),
    shouldSet-> this.setDefaultValue(shouldSet),
    () -> connection.setDefault() // Task: Attempts to default
);
```
