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

# Toggle

> Display a toggle switch that outputs true/false values for use in filters

![Basic Usage](https://mintcdn.com/evidence/lyRfl9dhvfuFUnx3/images/components/toggle/toggle.png?fit=max\&auto=format\&n=lyRfl9dhvfuFUnx3\&q=85\&s=aabf0876e9a4a0c433b1f5214ff3c254)

```liquid theme={null}
{% toggle
    id="show_legend"
    label="Show Legend"
/%}
```

## Examples

### Basic Usage

![Basic Usage](https://mintcdn.com/evidence/lyRfl9dhvfuFUnx3/images/components/toggle/toggle.png?fit=max\&auto=format\&n=lyRfl9dhvfuFUnx3\&q=85\&s=aabf0876e9a4a0c433b1f5214ff3c254)

```liquid theme={null}
{% toggle
    id="show_legend"
    label="Show Legend"
/%}
```

### Using `where`

![Using where](https://mintcdn.com/evidence/ImoR9rIJqT9N0Esa/images/components/toggle/example-1.png?fit=max\&auto=format\&n=ImoR9rIJqT9N0Esa\&q=85\&s=b174f1c0e655d6ed78f2da1702d9b314)

```liquid theme={null}
{% toggle
    id="active_only"
    label="Active Only"
/%}

{% table
    data="demo.daily_orders"
    where="{{active_only}} = false or total_sales > 1000"
/%}
```

### Using Inline SQL

![Using Inline SQL](https://mintcdn.com/evidence/ImoR9rIJqT9N0Esa/images/components/toggle/example-2.png?fit=max\&auto=format\&n=ImoR9rIJqT9N0Esa\&q=85\&s=3c4eafc986159f9a7045bb0c6ee8d881)

````liquid theme={null}
{% toggle
    id="active_only"
    label="Active Only"
/%}

```sql filtered_orders
select * from demo.daily_orders
where {{active_only}} = false or total_sales > 1000
```

{% table data="filtered_orders" /%}
````

## Attributes

**id** `string` *required*

The id of the toggle to be used in a `filters` prop

**label** `string`

Text displayed next to the toggle inside the box. Defaults to the id if not provided.

**info** `string`

Information tooltip text that appears after the label

**invert** `boolean` (default: false)

Invert the boolean value output. When true, checked = false and unchecked = true. Useful when toggle label semantics are opposite to the filter logic (e.g., a "Show inactive" toggle that filters for is\_active = false when checked).

**initial\_value** `boolean` (default: false)

Initial state of the toggle

## Using the Filter Variable

Reference this filter using `{{filter_id}}`. The value returned depends on where you use it.

| Context | Default Property | No Selection | Result |
| - | - | - | - |
| Inline SQL query | `.value` | | `true` |
| `where` attribute | `.value` | | `true` |
| Text / Markdown | `.value` | | `true` |

### Available Properties

You can also access specific properties using `{{filter_id.property}}`:

#### .value

Returns the boolean value of the toggle.

````liquid theme={null}
{% toggle id="active_filter" /%}

```sql active_users
select * from users
where is_active = {{active_filter}}
```
````

**Example value:** `true`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.