Skip to content

Widgets

Widgets are the visual building blocks of a dashboard. Each widget occupies a number of columns in a 12-column grid.

Common Fields

FieldTypeRequiredDescription
namestringYesDisplay name
typestringYesmetric, chart, table, text, image, or divider
colintegerNoColumn span from 1 to 12
descriptionstringNoOptional tooltip or subtitle

Data-backed widgets (metric, chart, table) also need a query source: query (named query reference), sql (inline), file (external .sql path), or a semantic reference (metric: for metric widgets, dimension: + metrics: for charts). See Queries & Templating for the full reference, including the connection override.

Metric

Metric widgets display a single value. The value is configured with a value encoding — which column to read, its type, and a d3-format string for display.

yaml
- name: Total Revenue
  type: metric
  sql: SELECT SUM(amount) AS value FROM sales
  value:
    field: value
    type: number
    format: "$,.2f"
  col: 3

field is required; bare column names (value: revenue) are not valid. When format is omitted the number is rendered with an auto-compact fallback (e.g. 1.2M).

Metric widgets can also use semantic models:

yaml
- name: Total Revenue
  type: metric
  model: sales
  metric: revenue
  filters:
    - dimension: created_at
      operator: between
      value:
        start: "{{ filters.date_range.start }}"
        end: "{{ filters.date_range.end }}"
  value:
    field: revenue
    type: number
    format: "$,.0f"
  col: 3

Semantic metric widgets inherit the dashboard-level model when model is omitted. See Semantic Layer for model files, filters, segments, and aliases.

Metric-specific fields:

FieldTypeDescription
valueobjectValue encoding: field (required), type, and format
value.fieldstringResult column to display
value.typestringnumber, date, or category
value.formatstringd3-format string (numbers, e.g. "$,.2f", ".0%") or d3-time-format string (dates, e.g. "%b %Y")
metricstringSemantic metric name

Note: Currency and unit affixes live in the format string — $ is a d3-format prefix ("$,.2f") and % comes from the percent type (".0%" renders 0.12 as 12%). There are no separate prefix/suffix fields.

Chart

Charts visualize one or more series. The chart field selects the chart type and determines which fields are required.

Chart types

ChartRequiredOptionalDescription
linex, ycolorLine chart
barx, ycolor, stacked, normalized, horizontalBar chart
areax, ycolorArea chart
pielabel, valuePie/donut chart
scatterx, yScatter plot
bubblex, y, sizeBubble chart
combox, ylinesMixed bar + line chart (y series in lines render as lines, the rest as bars)
histogramxbinsHistogram (client-side binning)
boxplotx, yBox-and-whisker plot (client-side quartiles)
funnellabel, valueFunnel chart
sankeysource, target, valueSankey/flow diagram
heatmapx, y, valueGrid heatmap
calendarx, valueGitHub-style calendar heatmap
sparklinex, yCompact inline line (60px), no axes
waterfallx, yWaterfall chart
xmrx, yyMin, yMaxControl chart with limits
dumbbellx, y (2 columns)Horizontal range comparison
gaugevaluetargetSemi-circular KPI-vs-target gauge (uses first row)
treemaplabel, valueRectangular part-to-whole hierarchy
radarx, yMulti-axis polar comparison
candlestickx, open, high, low, closeOHLC chart

SQL-backed example:

yaml
- name: Revenue Trend
  type: chart
  chart: area
  sql: |
    SELECT month, revenue
    FROM monthly_revenue
    ORDER BY month
  x: { field: month, type: date, format: "%b %Y" }
  y: { field: [revenue], type: number, title: Revenue, format: "$,.0f" }
  col: 8

Axis encoding

x and y are encoding objects. field names the SQL column to plot (y.field accepts a list for multiple series); the remaining keys control how the axis renders:

KeyTypeDescription
fieldstring | string[]SQL column(s) to plot. Required.
typestringnumber, date, or category. Selects the axis scale and the format language (date uses d3-time-format, otherwise d3-format).
titlestringHuman-readable axis label rendered next to the axis.
formatstringd3-format / d3-time-format string for tick labels, e.g. "$,.0f"$1,234, ".0%"12%, "%b %Y"Jan 2024.

Without format, ticks fall back to automatic compact formatting. Bare column names (x: month, y: [revenue]) are not valid — always wrap the column in { field: ... }.

Series by category (color)

color names a category column that splits the single y series into one series per distinct category value. The SQL returns long format — one row per x/category pair — instead of pivoting with CASE WHEN:

yaml
- name: Sales by Region
  type: chart
  chart: bar
  stacked: true                  # bar only; requires color
  color: { field: region }
  sql: |
    SELECT month, region, SUM(amount) AS revenue
    FROM sales GROUP BY 1, 2 ORDER BY 1, 2
  x: { field: month }
  y: { field: revenue }
  col: 6

Rules:

  • color works on bar, line, and area charts and requires a single y field.
  • stacked: true is bar-only and requires color. Listing multiple y columns renders grouped bars (or multiple lines/areas), never stacked.
  • normalized: true shows each stacked bar as percentages of the row total; the y axis renders % automatically, so omit y.format.
  • horizontal: true flips a bar chart: categories run down the vertical axis.

Semantic example:

yaml
- name: Revenue Trend
  type: chart
  chart: area
  model: sales
  dimension: created_at
  granularity: month
  metrics: [revenue]
  sort:
    - name: created_at
      direction: asc
  col: 8

Common chart fields:

FieldTypeDescription
chartstringChart type
xobjectX-axis encoding (field, type, title, format)
yobjectY-axis encoding (field may list several series columns)
labelstringLabel column for pie, funnel, and treemap charts
valueobjectValue encoding ({ field: ... }) for pie, funnel, sankey, heatmap, calendar, treemap, and gauge charts
sourcestringSource node column for sankey charts
targetstringTarget/max column for gauge charts (also sankey target node)
openstringOpen column for candlestick charts
highstringHigh column for candlestick charts
lowstringLow column for candlestick charts
closestringClose column for candlestick charts
colorobjectCategory column ({ field: ... }) that splits the single y series into one series per category — bar, line, and area charts
stackedbooleanStack the color series (bar charts only; requires color)
normalizedbooleanRender stacked bars as percentages of the row total (requires stacked)
horizontalbooleanHorizontal bars: categories on the vertical axis (bar charts only)
sizestringBubble size column for bubble charts
linesstring[]Which y series render as lines (rest as bars) for combo charts
binsintegerNumber of bins for histogram charts (default 10)
yMinstringLower control limit column for xmr charts
yMaxstringUpper control limit column for xmr charts
dimensionstringSemantic dimension name
granularitystringSemantic time grain for dimension
metricsstring[]Semantic metric names
filtersarraySemantic filters
segmentsstring[]Semantic segments
sortarraySort instructions
limitintegerRow limit

Charts using dimension, metrics, segments, or semantic filters are compiled through the backend semantic layer instead of requiring hand-written SQL.

Table

Tables display query results in a scrollable grid.

SQL-backed example:

yaml
- name: Recent Orders
  type: table
  sql: |
    SELECT id, customer_name, amount, status, created_at
    FROM orders
    ORDER BY created_at DESC
    LIMIT 20
  columns:
    - name: id
      label: Order ID
    - name: amount
      label: Amount
      format: currency

Semantic example:

yaml
- name: Sales Breakdown
  type: table
  model: sales
  dimensions:
    - name: region
    - name: channel
  metrics: [revenue, sales_count]
  sort:
    - name: revenue
      direction: desc
  columns:
    - name: region
      label: Region
    - name: revenue
      label: Revenue
      format: currency

Tables can mix semantic dimensions and metrics with explicit columns metadata for display labels and formatting.

Table column fields:

FieldTypeDescription
namestringResult column name (must match the SQL output)
labelstringDisplay header (defaults to name)
formatstringnumber or currency

Text

Text widgets render Markdown content.

yaml
- name: Notes
  type: text
  col: 6
  content: |
    **Important:** Data refreshes daily at 06:00 UTC.

Supported markdown:

  • Headers (# through ######)
  • Bold (**text**), italic (*text*), bold italic (***text***), strikethrough (~~text~~)
  • Inline code (`code`)
  • Links ([text](url)) and images (![alt](src))
  • Unordered lists (- or *) and ordered lists (1.)
  • Blockquotes (> text)
  • Horizontal rules (---, ***, or ___)

Image

Image widgets render an image from a URL.

yaml
- name: Logo
  type: image
  col: 3
  src: https://example.com/logo.png
  alt: Company Logo

Image-specific fields:

FieldTypeRequiredDescription
srcstringYesImage URL
altstringNoAlt text for accessibility

Divider

Divider widgets add visual separation between sections.

yaml
- name: Section Break
  type: divider
  col: 12