> For the complete documentation index, see [llms.txt](https://idontgiveaf.gitbook.io/fluent/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://idontgiveaf.gitbook.io/fluent/elements/guide/dropdowns.md).

# Dropdowns

### Changing Dropdown Values

To change what a dropdown has, use this.

```lua
Dropdown:SetValues({"one", "two", "three"})
```

{% hint style="warning" %}
If you don't set the right variable name, it won't work.
{% endhint %}

## Dropdown

To create a dropdown, use this.

```lua
local Dropdown = Tabs.Main:AddDropdown("Dropdown", {
    Title = "Dropdown",
    Description = "Dropdown description",
    Values = {"one", "two", "three"},
    Multi = false,
    Default = 1,
    Callback = function(Value)
        print("Dropdown was changed:", Value)
    end
})
```

{% hint style="warning" %}
If you are having issues, you're supposed to replace "Tabs.Main" with your actual tab.&#x20;

Example: "Tabs.Exploits"&#x20;

Whatever you put in your [Tabs](/fluent/components/window/tabs.md) variable, it's what you need.
{% endhint %}

The Value returns the selected value.

Change `local Dropdown` to a different variable name every time. It can be anything.

`Dropdown` (name of dropdown) is saved in the Options variable.

You can try to remove it, but I've never tried to.

You can get the value anywhere simply by using this: (Put your variable name)

```lua
Dropdown.Value
```

Or, whatever you put as the name of the toggle.

```lua
Options.Dropdown.Value
```

You can check when the dropdown is changed, but Callback does the same thing.

```lua
Dropdown:OnChanged(function(Value)
    print("Dropdown changed:", Value)
end)
```

To set the value of a dropdown, use this.

```lua
Dropdown:SetValue("three")
```

{% hint style="warning" %}
If you don't set the right variable name, it won't work.
{% endhint %}

## Multiple Dropdowns

To create a dropdown with multiple values, use this.

```lua
local MultiDropdown = Tabs.Main:AddDropdown("MultiDropdown", {
   Title = "Dropdown",
   Description = "You can select multiple values.",
   Values = {"one", "two", "three"},
   Multi = true,
   Default = {"seven", "twelve"},
})
```

{% hint style="warning" %}
If you are having issues, you're supposed to replace "Tabs.Main" with your actual tab.&#x20;

Example: "Tabs.Exploits"&#x20;

Whatever you put in your [Tabs](/fluent/components/window/tabs.md) variable, it's what you need.
{% endhint %}

Change `local MultiDropdown` to a different variable name every time. It can be anything.

`MultiDropdown` (name of dropdown) is saved in the Options variable.

You can try to remove it, but I've never tried to.

### Information

Multi Dropdowns are super annoying. It returns the Value of every Value and if it's true or not.

An example is shown below.

```lua
return {
    ["one"] = true
    ["two"] = true
    ["three"] = false
}
```

To get the value of something, simply use

```lua
MultiDropdown.Value["one"]
```

Or, whatever you put as the name of the toggle.

```lua
Options.MultiDropdown.Value["one"]
```

This will return "true" if it's true.

### Functions

You can check when the multi dropdown is changed, but Callback does the same thing.

```lua
MultiDropdown:OnChanged(function(Value)
    local Values = {}
    for Value, State in next, Value do
        table.insert(Values, Value)
    end
    print("Mutlidropdown changed:", table.concat(Values, ", "))
end)
```

To set the value of a multi dropdown, use this.

```lua
MultiDropdown:SetValue({
   three = true,
   five = true,
   seven = false
})
```

{% hint style="warning" %}
If you don't set the right variable name, it won't work.
{% endhint %}
