> For the complete documentation index, see [llms.txt](https://tanishisherewith.gitbook.io/archived-legacy-dynamichud/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/archived-legacy-dynamichud/contextmenu/contextmenuoptionsprovider-interface.md).

# ContextMenuOptionsProvider interface

This page talks about ContextMenuOptionsProvider interface

The [`ContextMenuOptionsProvider`](https://github.com/V-Fast/DynamicHUD/blob/master/src/main/java/com/tanishisherewith/dynamichud/util/contextmenu/ContextMenuOptionsProvider.java) interface defines a single method, `isOptionEnabled`, which takes a label as an argument and returns a boolean indicating whether the option with the given label is enabled or not.

This interface is used by the `ContextMenu` class to determine whether an option in the context menu should be enabled or disabled. When adding an option to the context menu, the `ContextMenu` class checks if the selected widget is an instance of `ContextMenuOptionsProvider`. If it is, the `ContextMenu` class calls the `isOptionEnabled` method on the selected widget to determine whether the option should be enabled or not.

In the textWidget class, There is an implementation of the `isOptionEnabled` method that returns different values depending on the label of the option. For example, if the label is "Shadow", this method returns the value of the `hasShadow` method. This allows you to control which options in the context menu are enabled or disabled based on the state of your widget.

Example:

{% code overflow="wrap" lineNumbers="true" %}

```java
 @Override
    public boolean isOptionEnabled(String label) {
        return switch (label) {
            case "Shadow" -> hasShadow();
            case "Rainbow" -> hasRainbow();
            case "Vertical Rainbow" -> hasVerticalRainbow();
            case "TextColor" -> isTextcolorOptionEnabled();
            case "DataColor" -> isDatacolorOptionEnabled();
            default -> false;
        };
    }
```

{% endcode %}
