Skip to main content
Using filters

Examples

Using filters

Using filters

Using where

Using where

Using Inline SQL

Vertical orientation inside a row

Vertical orientation inside a row

Attributes

id
string
required
The id of the button group to be used in a filters prop
data
string
Name of the table to query
filters
array
Array of filter IDs to apply when querying for options
value_column
string
Column name to use as the value for each option, and the column to filter by when this button group’s id is used in the filters prop of a chart
label_column
string
Column name to use as the label for each option
title
string
Text displayed above the button group
info
string
Information tooltip text
initial_value
string | number | array
Initial selected value(s)
multiple
boolean
default:"false"
Allows multiple selections
select_first
boolean
default:"false"
Automatically select the first option when the component loads
orientation
string
default:"horizontal"
Layout direction of the button group. Use “vertical” to stack buttons in a column. Best paired with a sibling element inside a row so the stack sits alongside its target content.Allowed values:
  • horizontal
  • vertical
max_height
number
Maximum height in pixels for the button stack when orientation="vertical". Buttons scroll if the list overflows. Ignored when horizontal.
order
string
Column name(s) with optional direction (e.g. “column_name”, “column_name desc”)
where
string
Custom SQL WHERE condition to apply to the query. For date filters, use date_range instead.
date_range
options group
Use date_range to filter data for specific time periods. Accepts predefined ranges (e.g., “last 12 months”), dynamic ranges (e.g., “Last 90 days”), custom date ranges (e.g., “2020-01-01 to 2023-03-01”), or partial ranges (e.g., “from 2020-01-01”, “until 2023-03-01”)Example:
Attributes:
  • range: string - Time period to filter. Use presets like ‘last 7 days’, dynamic patterns like ‘Last 90 days’, custom ranges like ‘2020-01-01 to 2023-03-01’, or partial ranges like ‘from 2020-01-01’.
    • Allowed values:
      • today
      • yesterday
      • last 7 days
      • last 30 days
      • last 3 months
      • last 6 months
      • last 12 months
      • previous week
      • previous month
      • previous quarter
      • previous year
      • this week
      • this month
      • this quarter
      • this year
      • next week
      • next month
      • next quarter
      • next year
      • week to date
      • month to date
      • quarter to date
      • year to date
      • all time
  • date: string - Date column to filter on. Required when the data has multiple date columns.

Using the Filter Variable

Reference this filter using {{filter_id}}. The value returned depends on where you use it. The examples below show values for three scenarios:
  • No selection
  • Single select: “Electronics” selected
  • Multi select: “Sports” and “Home” selected (when multiple=true)

Available Properties

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

.filter

Returns a complete SQL filter expression ready to use in WHERE clauses. Returns true when no value is selected.

.selected

Returns the selected value(s) wrapped in quotes, suitable for SQL comparisons. Returns an empty string when no value is selected.

.literal

Returns the raw unescaped selected value(s), useful for display in text or dynamic column selection.

.label

Returns the display label for the selected option(s). Falls back to the value if no label is defined.

.fmt

Returns the format string associated with the selected option. For multiple selections, returns the first format.

Allowed Children