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

# Toggle

# CustomToggle Component in SwiftUI

## Overview

`CustomToggle` is a SwiftUI component designed for creating a customizable toggle switch with a label. This component takes advantage of SwiftUI's `ToggleStyle` to allow for a visually appealing and interactive experience.

## Preview

<div style={{ display: "flex", justifyContent: "center" }}>
  <div style={{ marginRight: "40px" }}>
    <img src="https://www.swiftcn.lol/toggleOn.png" width="100" />

    <p>Toggle On</p>
  </div>

  <div>
    <img src="https://www.swiftcn.lol/toggleOff.png" width="100" />

    <p>Toggle Off</p>
  </div>
</div>

## Installation

Include the `CustomToggle.swift` file in your SwiftUI project. [File Link](https://github.com/Swiftcn-UI/swiftcn-playground/blob/main/Swiftcn%20Playground.swiftpm/Components/CustomToggle.swift)

## Properties

### Required Properties

* `label: String` - The label that appears next to the toggle.

### State Variable

* `state: Bool` - A state variable that tracks the on/off state of the toggle.

## Usage

### Basic Usage

Here's how you can use the `CustomToggle` component:

```swift theme={null}
CustomToggle(
    label: "Toggle me"
)
```
