> For the complete documentation index, see [llms.txt](https://brady-xyz.gitbook.io/maclib-ui-library/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://brady-xyz.gitbook.io/maclib-ui-library/getting-started/loading-maclib/creating-a-window/creating-a-tab-group/adding-tabs/adding-sections/toggle.md).

# Toggle

<figure><img src="https://2943218207-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhRtWRcExHV8IBJHoV9bx%2Fuploads%2FeI1i4HjiS7kQbALxauzV%2Fimage.png?alt=media&amp;token=b40fa646-e2d6-41bb-8b98-d93c8dcefa54" alt=""><figcaption></figcaption></figure>

```lua
Section:Toggle({
  Name <string>
  Default <boolean>
  Callback <function(): boolean>
}, <string or nil> Flag)
```

Functions

```lua
:UpdateName(<string>)
:SetVisiblity(<boolean>)
:UpdateState(<boolean>)
:GetState(: boolean)

.State : boolean
.IgnoreConfig <boolean>
.Settings : table -- Not everything may be updated, but Callback should be correct.
```

Example

```lua
sections.MainSection1:Toggle({
	Name = "Flight",
	Default = false,
	Callback = function(value)
		Window:Notify({
			Title = "Kuzu Hub",
			Description = (value and "Enabled " or "Disabled ") .. "Flight"
		})
	end,
}, "FlightToggle")
```
