metric: Metric

View source: R/widget-display.R

metricR Documentation

Metric

Description

A key number with a label and an optional change (delta) shown as a green up or red down arrow. Useful in dashboards.

Usage

metric(
  label,
  value = NA,
  delta = NULL,
  format = NULL,
  id = NULL,
  classes = NULL,
  style = NULL
)

Arguments

label

Label shown above the value.

value

The value (any R value; numbers are formatted with thousands separators).

delta

Optional change since the last value.

format

Optional ⁠function(value)⁠ returning a string (also used for the delta).

id

Optional identifier.

classes

Optional classes.

style

A style().

Value

A Metric widget with reactive value and delta, and method update(value, delta).

Examples

render_widget(metric("Accuracy", 0.943, delta = 0.012), 20, 4)

termr documentation built on Oct. 21, 2026, 5:13 p.m.