> ## Documentation Index
> Fetch the complete documentation index at: https://luau.limerence.biz/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> api.bind: read keybinds the user has set on UI elements.

Inspect every keybind the user has set up, the same data the BindEditor right-click menu shows. Useful for building your own on-screen list of active keybinds.

Signal connections clean up automatically when your script unloads.

## list

```luau theme={null}
api.bind.list(): { BindInfo }
```

Every keybind the user has.

## getActive

```luau theme={null}
api.bind.getActive(): { BindInfo }
```

Just the keybinds currently being held or toggled on.

## get

```luau theme={null}
api.bind.get(id: number): BindInfo?
```

A specific keybind by id, or `nil` if it doesn't exist.

## getInputLabel

```luau theme={null}
api.bind.getInputLabel(input: Enum.KeyCode | Enum.UserInputType | string): string
```

A friendly name for an input, like `"LShift"`, `"E"`, or `"LMB"`. Accepts a `KeyCode`, `UserInputType`, or a string like `"KeyCode.E"`.

## isAnyBindActive

```luau theme={null}
api.bind.isAnyBindActive(): boolean
```

True if any keybind anywhere is currently active.

## Signals

Call `:Connect(callback)`. Every callback receives a [BindInfo](/reference/types#bindinfo) for the affected keybind.

| Signal          | When your callback runs                                 |
| --------------- | ------------------------------------------------------- |
| `onCreated`     | User added a new keybind (via right-click on a control) |
| `onRemoved`     | A keybind was deleted                                   |
| `onActivated`   | A keybind just turned on (pressed or toggled)           |
| `onDeactivated` | A keybind just turned off                               |
| `onChanged`     | The user changed which keys are bound, or the mode      |

## BindInfo

```luau theme={null}
{
    id = 12,                    -- unique id
    name = "elb_12",            -- internal name
    label = "Aim Assist",       -- what the user sees in the menu
    inputs = { "KeyCode.E" },   -- the bound keys
    inputLabels = { "E" },      -- friendly names
    mode = "onHold",            -- "toggle", "onHold", or "offHold"
    active = true,
    targetValue = nil,          -- nil = invert boolean
}
```

## Example: live keybind list

```luau theme={null}
local tab = api.ui.tab("Binds", "keybinds")
local section = tab:AddSection("Active", 1)

local entries = {} -- id -> button handle

local function add(info)
    if entries[info.id] then return end
    entries[info.id] = section:AddButton(
        string.format("%s [%s]", info.label, table.concat(info.inputLabels, "+"))
    )
end

local function remove(info)
    local h = entries[info.id]
    if h then h:Destroy() entries[info.id] = nil end
end

for _, info in ipairs(api.bind.list()) do add(info) end

api.bind.onCreated:Connect(add)
api.bind.onRemoved:Connect(remove)
api.bind.onChanged:Connect(function(info)
    local h = entries[info.id]
    if h then
        h:SetText(string.format("%s [%s]", info.label, table.concat(info.inputLabels, "+")))
    end
end)
```
