BonnardBonnard0.2.12

Inputs

Interactive filter inputs for dashboards — date range pickers and dropdown selectors.

Overview

Inputs add interactivity to dashboards. They render as a filter bar above the charts and re-execute queries when values change. Inspired by Evidence.dev's inputs pattern, adapted for the Cube semantic layer.

Two input types are available:

  • DateRange — preset date range picker that overrides timeDimension.dateRange
  • Dropdown — dimension value selector that adds/replaces filters

DateRange

Renders a date range preset picker. When changed, overrides timeDimension.dateRange on targeted queries.

<DateRange name="period" default="last-6-months" label="Time Period" />

Props

PropTypeRequiredDescription
namestringYesUnique input name
defaultpreset keyNoInitial preset (default: last-6-months)
labelstringNoLabel shown above the picker
queriesstringNoComma-separated query names to target

Targeting

Targeting lets you control which queries a filter affects — useful when some charts should stay fixed while others respond to filter changes.

  • No queries prop — applies to ALL queries that have a timeDimension
  • With queries prop — only applies to the listed queries

Presets

KeyLabel
last-7-daysLast 7 Days
last-30-daysLast 30 Days
last-3-monthsLast 3 Months
last-6-monthsLast 6 Months
last-12-monthsLast 12 Months
month-to-dateMonth to Date
year-to-dateYear to Date
last-yearLast Year
all-timeAll Time

Renders a dropdown selector populated from a query's dimension values. Adds a filter on the specified dimension to targeted queries.

<Dropdown name="channel" dimension="orders.channel" data={channels} queries="main,trend" label="Channel" />

Props

PropTypeRequiredDescription
namestringYesUnique input name
dimensionstringYesDimension to filter on
dataquery refYesQuery that provides the dropdown options
queriesstringYesComma-separated query names to filter
labelstringNoLabel shown above the dropdown
defaultstringNoInitial selected value (default: All)

Behavior

  • Always includes an "All" option that removes the filter
  • The dropdown's own data query is never filtered by itself (prevents circular dependencies)
  • queries is required — the dropdown only filters explicitly listed queries

Examples

DateRange only

---
title: Revenue Trends
---

<DateRange name="period" default="last-6-months" label="Time Period" />

` ``query monthly_revenue
measures: [orders.total_revenue]
timeDimension:
  dimension: orders.created_at
  granularity: month
` ``

<LineChart data={monthly_revenue} x="orders.created_at" y="orders.total_revenue" />

The DateRange automatically applies to monthly_revenue because it has a timeDimension. No hardcoded dateRange needed in the query.

---
title: Sales by Channel
---

` ``query channels
dimensions: [orders.channel]
` ``

<Dropdown name="ch" dimension="orders.channel" data={channels} queries="main" label="Channel" />

` ``query main
measures: [orders.total_revenue]
dimensions: [orders.city]
` ``

<BarChart data={main} x="orders.city" y="orders.total_revenue" />

Combined inputs

---
title: Sales Dashboard
---

<DateRange name="period" default="last-6-months" label="Time Period" />
<Dropdown name="channel" dimension="orders.channel" data={channels} queries="trend,by_city" label="Channel" />

` ``query channels
dimensions: [orders.channel]
` ``

` ``query trend
measures: [orders.total_revenue]
timeDimension:
  dimension: orders.created_at
  granularity: month
` ``

<LineChart data={trend} x="orders.created_at" y="orders.total_revenue" />

` ``query by_city
measures: [orders.total_revenue]
dimensions: [orders.city]
` ``

<BarChart data={by_city} x="orders.city" y="orders.total_revenue" />

Both inputs work together: the DateRange scopes the time window on trend (which has a timeDimension), and the Dropdown filters both trend and by_city by channel.

Shareable URLs

Input values automatically sync to URL query params. When a user changes a filter, the URL updates to reflect the current state — for example:

/dashboards/sales?period=last-30-days&channel=Online
  • Default values are omitted from the URL for clean links
  • Sharing a URL preserves the current filter state — recipients see exactly the same filtered view
  • Refreshing the page restores the active filters from the URL
  • The Copy Link button in the dashboard header copies the full URL including filter params

DateRange inputs store the preset key (e.g. last-30-days), so shared URLs stay relative to today. Dropdown inputs store the selected value string.

See Also

On this page