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

# Buttons & Toggles

> Create one-shot actions and stateful boolean controls.

Buttons register with Quick Commands automatically. By default they execute once; `InternalInfo.Toggle = true` turns the same component into a boolean toggle.

## Action button

```lua theme={null}
tab:AddButton({
	Info = {
		Title = "Respawn",
		Description = "Reset the local humanoid health.",
	},
	InternalInfo = {
		UniqueCommandId = "respawn",
		Aliases = { "re", "reset" },
	},
	Callback = function()
		local player = game.Players.LocalPlayer
		local character = player.Character
		local humanoid = character and character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			humanoid.Health = 0
		end
	end,
})
```

A normal button callback receives no arguments.

## Toggle button

```lua theme={null}
tab:AddButton({
	Info = {
		Title = "Noclip",
		Description = "Toggle the local noclip feature.",
	},
	InternalInfo = {
		Toggle = true,
		UniqueCommandId = "noclip",
		Bindable = true,
		StartupAvailable = true,
		Aliases = { "nc" },
	},
	Callback = function(enabled)
		print("Noclip:", enabled)
	end,
})
```

Toggle callbacks receive the new boolean state.

## Rich text

Button titles and description tooltips render Roblox rich-text markup by default:

```lua theme={null}
tab:AddButton({
	Info = {
		Title = "<b>Heal</b> <font color=\"#9D7BFF\">Player</font>",
		Description = "<i>Restores the player's health.</i>",
	},
})
```

Set `RichText = false` on the button config or inside `Info` to render both as plain
text:

```lua theme={null}
tab:AddButton({
	RichText = false,
	Info = { Title = "<b>Plain text</b>" },
})
```

## Configuration

**Info.Title** `string` (default: "Button")

Button title. For toggles this is also the displayed toggle label.

**Info.Description** `string`

Tooltip text displayed instantly while hovering the control. Use `\n` for line breaks.

**RichText** `boolean` (default: true)

Enables rich-text markup for the button title and description tooltip. Set to `false`
to opt out. `Info.RichText` is also accepted.

**InternalInfo.UniqueCommandId** `string`

Stable command ID. A random ID is generated when omitted.

**InternalInfo.Toggle** `boolean` (default: false)

Turns the action button into a stateful boolean toggle.

**InternalInfo.Bindable** `boolean` (default: false)

Adds a right-click menu for assigning or removing a keyboard shortcut.

**InternalInfo.StartupAvailable** `boolean` (default: false)

Adds a right-click **Toggle Startup** option. For buttons, a saved startup flag executes the callback with `true` during the next library initialization.

**Aliases** `string[]`

Alternate Quick Commands names. `Info.Aliases` and `InternalInfo.Aliases` are also recognized.

**Callback** `function`

Normal button: `Callback()`. Toggle button: `Callback(state)`.

## Quick Commands

Normal buttons are invoked by command name or alias:

```text theme={null}
respawn
re
```

Toggle buttons accept an explicit state or flip when no state is supplied:

```text theme={null}
noclip on
noclip off
noclip true
noclip false
noclip
```

## Right-click actions

When `Bindable` or `StartupAvailable` is enabled, right-clicking the button opens its flyout.

* **Assign a New Keybind** stores the selected keyboard key by command ID.
* **Remove Keybind** clears the saved binding.
* **Toggle Startup** stores the startup flag.

## Returned handle

`AddButton()` returns a handle with both GUI references and control methods:

```lua theme={null}
local button = tab:AddButton({
	Info = { Title = "Example" },
	InternalInfo = { Toggle = true },
	Callback = function(state)
		print(state)
	end,
})

print(button:getId())
print(button:getValue())

button.setVisualState(true)
button.activate()
```

| Member | Behavior |
| :- | :- |
| `frame` | Outer `Frame` instance. |
| `button` | Clickable `ImageButton`. |
| `text` | Title `TextLabel`. |
| `isToggle` | Boolean indicating toggle mode. |
| `getValue()` | Current stored state. Normal buttons usually remain `false`; toggles return a boolean. |
| `getId()` | Resolved command ID. |
| `updateText()` | Refreshes the title and any saved keybind suffix. |
| `setVisualState(state)` | Updates stored toggle state and visuals. |
| `activate()` | Executes the button using the same callback path as a click. |

> [!WARNING]
>
> `activate()` and `setVisualState()` are convenient programmatic hooks, but they do not add new persistence semantics beyond what the component already implements.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.