---
updatedAt: 2025-07-15T08:32:40.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# Toggle

Overview of the **Toggle** Component

The **ToggleWrappper** component changes the state of a single option. They can be switched on or off by pressing or swiping. They can also be checked programmatically by setting the **Checked** property.

# Properties

> 🚧 Important Note!
>
> This document lists the properties that are specific to this particular UI component.\
> To check for the properties common for most UI components, please check the **[General components](https://docs.appery.io/docs/ionic-ui-components-properties-general#general-components-properties)** document.

Every new **CheckboxWrapper** component is created with two default child components: **Checkbox** and **ItemLabel**.

## *Common* Properties

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Property Name
      </th>

      <th>
        Property Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        Item Wrapped
      </td>

      <td>
        If set to ***true***, the component will be included in the Item with additional properties
      </td>
    </tr>

    <tr>
      <td>
        Show Label
      </td>

      <td>
        If set to ***true***, the component will have a label.
      </td>
    </tr>

    <tr>
      <td>
        Lines
      </td>

      <td>
        How the bottom border should be displayed on the item. Possible values are; ***Full***, ***Inset***, ***None***.
      </td>
    </tr>

    <tr>
      <td>
        Reorder
      </td>

      <td>
        Reorder properties:  

        * \*Typ&#x65;**-***Content***or***Wrapper***. If***Wrapper*\*\* is used, the item will be wrapped into a reorder tag.  
        * \*Ico&#x6E;**- custom icon for**Reorder**with a type***Content***. Click the**Default icon\*\* button to select the needed icon.  
        * \*Slo&#x74;**- position inside the item:***Start***or***End*\*\*.  
        * \*SVG Ico&#x6E;**- used to select an`svg` file. This path will be added as the `src` attribute. Click the **&#x43;hange**button to select the uploaded image from**[Media Manager](https://docs.appery.io/docs/3-creating-an-app-ui-styling-apps#using-media-manager)\*\*.
      </td>
    </tr>
  </tbody>
</Table>

# *Toggle*

The **Toggle** component has the following properties:

## *Common* Properties

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Property Name
      </th>

      <th>
        Property Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        Name
      </td>

      <td>
        The name of the control, which is submitted with the form data
      </td>
    </tr>

    <tr>
      <td>
        Value
      </td>

      <td>
        The value of the toggle does not mean if it is checked or not, use the ***checked*** property for that. The value of a toggle is analogous to the value of a `<input type=checkbox>`, it is only used when the toggle participates in a native **form**. The default is set to  ***on***.
      </td>
    </tr>

    <tr>
      <td>
        Checked
      </td>

      <td>
        If set to ***true***, the toggle is selected. The default is set to ***false***.\
        Not available if the toggle is included in the **[Form](#form)** component.
      </td>
    </tr>

    <tr>
      <td>
        [(ngModel)]
      </td>

      <td>
        [Angular directive](https://angular.io/api/forms/NgModel) for data binding.
      </td>
    </tr>

    <tr>
      <td>
        (ionChange)
      </td>

      <td>
        The event emitted when the value has changed.
      </td>
    </tr>
  </tbody>
</Table>

## *Styles* Properties

Under the **Styles** tab, toggles can be styled with several attributes to look like in a specific way:

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Property Name
      </th>

      <th>
        Property Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        Handle
      </td>

      <td>
        Toggle handle properties:  

        * \*Border Radius\*\* - border radius of the toggle handle in `px`, `%`, `em`, `vh`, and `vw`.  
        * \*Colo&#x72;**- select the background color of the toggle handle from the available colors:***Primary***,***Secondary***,***Tertiary***,***Success***,***Warning***,***Danger***,***Light***,***Medium***,***Dark***, and**Custom\*\* or use the *Color-picker*.  
        * \*Color Checke&#x64;**- select the background color of the toggle handle when checked from the available colors:***Primary***,***Secondary***,***Tertiary***,***Success***,***Warning***,***Danger***,***Light***,***Medium***,***Dark***, and**Custom\*\* or use the *Color-picker*.  
        * \*Handle Width\*\* in `px`, `%`, `em`, `vh`, and `vw`  
        * \*Max Height\*\* in `px`, `%`, `em`, `vh`, and `vw`.  
        * \*Spacing\*\* - horizontal spacing around the toggle handle in `px`, `%`, `em`, `vh`, and `vw`.
      </td>
    </tr>

    <tr>
      <td>
        Track
      </td>

      <td>
        Toggle track properties:  

        * \*Border Radius\*\* - border radius of the toggle track in `px`, `%`, `em`, `vh`, and `vw`  
        * \*Colo&#x72;**- select the background color of the toggle track from the available colors:***Primary***,***Secondary***,***Tertiary***,***Success***,***Warning***,***Danger***,***Light***,***Medium***,***Dark***, and**Custom\*\* or use the *Color-picker*.  
        * \*Color Checke&#x64;**- select the background color of the toggle track when checked from the available colors:***Primary***,***Secondary***,***Tertiary***,***Success***,***Warning***,***Danger***,***Light***,***Medium***,***Dark***, and**Custom\*\* or use the *Color-picker*.
      </td>
    </tr>
  </tbody>
</Table>

# *ItemLabel*

The **ItemLabel** component has the following properties:

## *Common* Properties

| Property Name | Property Description                                                    |
| :------------ | :---------------------------------------------------------------------- |
| Truncate Text | Set to ***True*** (default) to truncate label text if it is too long.   |
| Position      | The position determines where and how the label behaves inside an item. |

## *Styles* Properties

Under the **Styles** tab, **ItemLabel** components can be styled with the following attributes to look like in a specific way:

| Property Name | Property Description                                                  |
| :------------ | :-------------------------------------------------------------------- |
| Font Size     | Enter font size in `px`, `%`, `em`, `vh`, and `vw`.                   |
| Font Weight   | Set the weight (or boldness) of the font: ***Normal*** or ***Bold***. |

# Using *Toggle* as a Form Control

The component is the [Form Control](#composition) of Angular [form](https://angular.io/guide/forms) when:

* it is included into the **[Form](#form)** component
* the **[Form](#form)** has the **Native validation** property disabled (is set to ***False***)
* it doesn't have the **Standalone** option under **Control Options** enabled
* the component has the property **Name** specified:

<Image align="center" className="border" border={true} src="https://files.readme.io/19e8150-2023-01-26_23-38-04.png" />

> 🚧 Note!
>
> Use the following description only when the **[Form](#form)** component has the disabled **Native validation** property. If the **Native validation** property is enabled the control can be used as a default **HTML** [Form Control](#composition).

To set the initial value of the control use the **Initial Value** property of the **[Form Control](#composition)** properties section. The component can have only boolean (***true*** or ***false***) values or ***null***. If the property isn't specified the initial value will be ***null***.

To use variables as the control's data, the advanced property **\[(ngModel)]** should be specified - the variable name should be entered as the property value. It replaces the value that is set by the **Initial Value** property.

As a [Form Control](#composition), the component can get additional properties (**Control ID** and **Control options**) that allow checking the validity, changing updating strategy, etc. These properties can be used if the **Native Validation** property is disabled for the **[Form](#form)** component.\
Read more about [validation ](#validation) in the [Form](#form) section.

> 🚧 Note!
>
> The component can't be used with array iteration data for creating a dynamic form structure. If you need to create such kind of structure, follow [these recommendations](https://angular.io/guide/dynamic-form#building-dynamic-forms)

Visit the [Ionic documentation](https://ionicframework.com/docs/api/toggle) to read more about the Ionic toggle.