> For the complete documentation index, see [llms.txt](https://docs.navigaglobal.com/writer/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.navigaglobal.com/writer/8.1.4/api-reference/uicomponents/uitoggle.md).

# UIToggle

Create a simple toggle component

**Since**: 7.0.0 (4.9.0)

| Name       | Type       | Default                | Description                                                                                                                 |
| ---------- | ---------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| id         | `string`   |                        | **Required** - Id of the toggle                                                                                             |
| label      | `string`   |                        | **Required** - The text label                                                                                               |
| alignRight | `boolean`  | `false`                | Set to true to have label place to the right                                                                                |
| checked    | `boolean`  | `false`                | Wether the toggle is on or off                                                                                              |
| disabled   | `boolean`  | `false`                | Wether the toggle is disabled or not                                                                                        |
| tabIndex   | `number`   |                        | Apply specific tab index                                                                                                    |
| size       | `string`   | `"&quot;normal&quot;"` | Normal                                                                                                                      |
| icon       | `string`   |                        | Icon name from style-guide. Example `arrow-right-bold` (or (Deprecated) FontAwesome 4 icon. Example `fa-user`). Prefix text |
| onToggle   | `function` |                        | Callback for when the toggle value changes                                                                                  |

### Example

```js
import {UIToggle} from 'writer'

render($$) {
    const el = $$('div')
    return el.append(
        $$(UIToggle, {
            id: 'mytoggle',
            label: this.getLabel('My toggle'),
            checked: true,
            onToggle: (checked) => {
                // Do something
            }
        })
    )
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.navigaglobal.com/writer/8.1.4/api-reference/uicomponents/uitoggle.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
