Skip to main content
Basic Usage
{% toggle
    id="show_legend"
    label="Show Legend"
/%}

Examples

Basic Usage

Basic Usage
{% toggle
    id="show_legend"
    label="Show Legend"
/%}

Using where

Using where
{% 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
{% 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.
ContextDefault PropertyNo SelectionResult
Inline SQL query.valuetrue
where attribute.valuetrue
Text / Markdown.valuetrue

Available Properties

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

.value

Returns the boolean value of the toggle.
{% toggle id="active_filter" /%}

```sql active_users
select * from users
where is_active = {{active_filter}}
```
Example value: true