documentation /concept

Metrics Card

Concept

Use a SQL query that returns exactly one row, then show chosen columns as labeled metrics with semantic HTML formatting. Prefer this when each metric should read as a structured label or value pair rather than free-form richtext.

Outline Display: Look up metrics from {{query}} and display: {{ingredients}}

Details

The query may use UI parameters from the handler URL. The card refreshes when watched tables change. Each ingredient selects one showable column; optional SQL outputs are not supported for metric lines yet. An optional caption overrides the column label. Metrics render as a native <dl>: composed ingredients contribute sibling dt/dd pairs with no wrapper element.

Requirements

The SQL query must return exactly one row. Give outputs readable AS aliases. Each metric line must reference a single non-optional column with a showable type (numbers, money, decimal, text, bool, time or date, formatted text).

Local scope

Names introduced within this component’s knobs:

  • uiArgs – virtual table holding this handler’s parameters
  • queryTab – result columns of query (referenceable as a virtual table)

Settings

Required

  • query : SQL query
    SQL returning exactly one row whose columns supply the metrics.
    Must produce: any number of results matching showable type
    Scope: all columns of uiArgs (reference as [ColumnName], e.g., [Name], [Price]).

Optional

  • ingredients : ingredient slot of metricsCardIngredients(queryTab) (many)
    Metric lines to render from the query row.