# Switch

## **Specs**

<table><thead><tr><th width="320">Label</th><th>Value</th></tr></thead><tbody><tr><td><strong>Version</strong></td><td>2.0.0 (updated on 2024-04-02)</td></tr><tr><td><strong>Developer</strong></td><td>Labii Inc.</td></tr><tr><td><strong>Type</strong></td><td>Column</td></tr><tr><td><strong>Support Configuration</strong></td><td>Yes</td></tr><tr><td><strong>Support Readonly view</strong></td><td>Yes</td></tr><tr><td><strong>Support Edit view</strong></td><td>Yes</td></tr><tr><td><strong>Support Form view</strong></td><td>Yes</td></tr><tr><td><strong>Support Default value</strong></td><td>Yes</td></tr><tr><td><strong>Support Import</strong></td><td>Yes</td></tr><tr><td><strong>Allow multiple</strong></td><td>Yes</td></tr></tbody></table>

## Overview

The Labii Switch widget is a specialized checkbox designed for toggling binary states, like on/off options, in a unique and user-friendly manner.

## Use case

1. Use this widget to display Pass/Fail of data checking.
2. Use this widget to display whether a task is completed.

## Configuration

The widget will function without additional setup, but you have the option to utilize the configuration for label customization.

* **Label when switch is 'On'** - Provide a label when the switch is 'On'. The column name will be used if not provided.
* **Label when switch is 'Off'** - Provide a lable when the switch is 'Off'.
* **Should hide label** - If you want to hide the switch label, check this field.
* **Date column** - Choose the Date column from the task table, assuming this column is situated within the task table.
* **Frequency column** - Choose the Frequency column from the task table, assuming this column is situated within the task table.

### Examples:

Show "Pass/Fail" labeling for a column.

```json
{
    "on_label": "Pass",
    "off_label": "Fail"
}
```

Hide switch labels

```json
{
    "should_hide_label": true
}
```

Update the actions for the tasks

```json
{
    "date": {
        "sid": "xxx",
        "name": "date"
    },
    "frequency": {
        "sid": "xxx",
        "name": "date"
    }
}
```

## Views

See the interface of the widget in the following views.

### **Readonly view**

Readonly view display the values of the column.

<figure><img src="https://3607108856-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LHVg57XIRcjV-Vbubtn%2Fuploads%2Fgit-blob-be0c7a9c98e03e40ce8564774d3e59b9e53997c4%2Fwidget-column-switch.webp?alt=media" alt=""><figcaption></figcaption></figure>

Once the widget is set up for tasks, it automatically adjusts task dates according to their frequency. For instance, if a task is dated 2024-01-01 and set to recur weekly, marking it as completed will update its date to 2024-01-08.

### **Edit view**

The Edit view is the interface that allows you to modify the value.

The Edit view is same as the Readonly view

### **Form view**

The Form view is the field integrated into the add form for collecting values when creating a new record.

The Form view is same as the Readonly view.

## Data

Each widget in Labii stores data in a unique manner; refer below to understand how data from this widget is stored.

### Data format

Boolean

### **Default value**

The Default Value field within the column allows you to specify the default value when a record is created.

Default value shall be `true` or `false`.

### **Import value**

The Import Value is the value you need to include in your Excel table for it to be imported into Labii.

Import value shall be `true` or `false`.
