> ## 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.

# Table Filter

> A filter component for tables with multiple condition support

![Using filters](https://mintcdn.com/evidence/3VqmJP-3dtFa-PrP/images/components/table_filter/table_filter.png?fit=max\&auto=format\&n=3VqmJP-3dtFa-PrP\&q=85\&s=bcf23945899bee094b96181b1d1e0992)

```liquid theme={null}
{% table_filter
    id="my_filter"
    data="demo.daily_orders"
/%}

{% bar_chart
    data="demo.daily_orders"
    x="date"
    y="sum(total_sales)"
    filters=["my_filter"]
    date_grain="month"
/%}
```

## Examples

### Using `filters`

![Using filters](https://mintcdn.com/evidence/3VqmJP-3dtFa-PrP/images/components/table_filter/table_filter.png?fit=max\&auto=format\&n=3VqmJP-3dtFa-PrP\&q=85\&s=bcf23945899bee094b96181b1d1e0992)

```liquid theme={null}
{% table_filter
    id="my_filter"
    data="demo.daily_orders"
/%}

{% bar_chart
    data="demo.daily_orders"
    x="date"
    y="sum(total_sales)"
    filters=["my_filter"]
    date_grain="month"
/%}
```

### Using Inline SQL

````liquid theme={null}
{% table_filter
    id="my_filter"
    data="demo.daily_orders"
/%}

```sql filtered_orders
select * from demo.daily_orders
where {{my_filter.filter}}
```

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

### Custom Title

```liquid theme={null}
{% table_filter
    id="orders_filter"
    data="demo.daily_orders"
    title="Order Search"
/%}
```

### Mixed Single and Multi Select

```liquid theme={null}
{% table_filter
    id="mixed_filter"
    data="demo.daily_orders"
    columns=["category", "item"]
    single_select=["category"]
/%}
```

## Attributes

**id** `string` *required*

Unique identifier for the filter component

**className** `string`

Additional CSS classes to apply

**data** `string` *required*

ID of the table to filter

**title** `string`

Custom title text for the filter button (defaults to "Filter" in the page language)

**defaultConjunction** `string` (default: AND)

Default conjunction between filters (AND or OR)

**Allowed values:**

* `AND`
* `OR`

**columns** `array`

Array of column IDs to filter on. If not provided, all columns are available for filtering

**labels** `array`

Array of custom labels to display instead of column names. Must match the order of the columns array.

**showClearButton** `boolean` (default: true)

Whether to show a clear button to remove all filters

**minimumRecords** `number`

When set, string filters will only show values that have at least this many records, and filters will always use AND conjunction

**multiple** `boolean` (default: true)

When false, string filters will only allow selecting a single value instead of multiple values. Can be overridden per column with single\_select and multi\_select.

**single\_select** `array`

Array of column names whose string filter only allows selecting a single value, regardless of the multiple setting

**multi\_select** `array`

Array of column names whose string filter allows selecting multiple values, regardless of the multiple setting

**initial\_values** `object`

An object with column names as keys and this filter's initial value for that column as the value

**require\_selection** `array`

An array containing column names that always require a selection. Only supports text columns.

**width** `number`

Set the width of this component (in percent) relative to the page width

## 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 | `.filter` | `true` | `category = 'Electronics' AND total_sales > 1000` |
| `where` attribute | `.filter` | `true` | `category = 'Electronics' AND total_sales > 1000` |
| Text / Markdown | `.filter` | `true` | `category = 'Electronics' AND total_sales > 1000` |

### Available Properties

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

#### .filter

Returns a complete SQL filter expression combining all active filter conditions. Returns `true` when no filters are active.

````liquid theme={null}
{% table_filter id="my_filter" data="demo.daily_orders" /%}

```sql filtered_orders
select * from demo.daily_orders
where {{my_filter}}
```
````

**Example value:** `category = 'Electronics' AND total_sales > 1000`

#### .literal

Returns the active condition values as comma-separated text, in filter order. Ranges show both endpoints. Column names and operators are omitted. Returns an empty string when no filters are active.

```liquid theme={null}
{% table_filter id="categories" data="demo.daily_orders" columns=["category"] /%}

Showing orders for {{categories.literal | all categories}}.
```

**Example value:** `Electronics, Clothing`

#### .summary

Describes active filters as an English clause for use after “where”. Uses column labels, operators, and the filter’s AND or OR conjunction. Returns an empty string when no filters are active.

```liquid theme={null}
{% table_filter id="orders" data="demo.daily_orders" /%}

This report shows orders where {{orders.summary | all records match}}.
```

**Example value:** `Region is West or East and Order Total is between 100 and 500`


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