# switch

This is a switch/toogle input field for any values. It can toggle true/false, yes/no, on/off values.

## Special properties of field

| Property   | Default | Accepted values            | Description                              |
| ---------- | ------- | -------------------------- | ---------------------------------------- |
| `textOn`   | *none*  | `String`                   | Visible label if the switch state is on  |
| `textOff`  | *none*  | `String`                   | Visible label if the switch state is off |
| `valueOn`  | *none*  | any primitives or `Object` | Value if the switch state is on          |
| `valueOff` | *none*  | any primitives or `Object` | Value if the switch state is off         |

## Usage

Simple example with active/inactive labels

```javascript
{
    type: "switch",
    label: "Status (switch field)",
    model: "status",
    textOn: "Active",
    textOff: "Inactive"
}
```

Example with male/female model values

```javascript
{
    type: "switch",
    label: "Sex",
    model: "sex",
    textOn: "Female",
    textOff: "Male",
    valueOn: "female",
    valueOff: "male"
}
```


---

# Agent Instructions: 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://vue-generators.gitbook.io/vue-generators/develop/fields/optional_fields/switch.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.
