> For the complete documentation index, see [llms.txt](https://swift-packages.gitbook.io/materialuikit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://swift-packages.gitbook.io/materialuikit/components/checkbox.md).

# Checkbox

Represent a Material UI styled checkbox for toggling a boolean state.

### Overview

The `Checkbox`  provides a customizable checkbox with Material UI styling. It allows users to toggle between checked and unchecked states.

To use the `Checkbox` component, initialize it with a title and bind it to a Boolean value to control its state.

### Initializer

Creates a checkbox with a specified title and state binding.

```swift
Checkbox(_ titleKey: String, isOn: Binding<Bool>)
```

### Parameters

<table><thead><tr><th width="200">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>titleKey</code></td><td>The title displayed next to the checkbox.</td></tr><tr><td><code>isOn</code></td><td>A <code>Binding&#x3C;Bool></code> to control the checkbox's state.</td></tr></tbody></table>

### **Example**

```swift
@State private var isChecked = false

var body: some View {
    Container {
        Checkbox("Toggle Checkbox", isOn: $isChecked)
    }
}
```

<figure><picture><source srcset="/files/0k6Rchi1Co1WEzoXFDj1" media="(prefers-color-scheme: dark)"><img src="https://2931569195-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHpwjDgYAa64eKF8AGmeE%2Fuploads%2FqEzScZVbkz7xs2nLeBgB%2FCheckbox%20Light.png?alt=media&amp;token=dbcf75bb-e90e-45ab-8206-5b7b043945e4" alt=""></picture><figcaption></figcaption></figure>
