Renders a deterministic text representation of one important metric.
This function is framework-independent. Import it from blessed-components/stat to keep Blessed outside the module graph.
blessed-components/stat
Stacked output:
[label] [value][unit] [optional trend] [optional description] Copy
[label] [value][unit] [optional trend] [optional description]
Inline output:
Label, value, layout, unit, trend, and description.
Plain text without ANSI sequences or Blessed tags.
RangeError Thrown when a numeric primary or trend value is not finite.
RangeError
RangeError Thrown when any configured trend character is empty.
import { renderStat } from 'blessed-components/stat';renderStat({ label: 'Revenue', value: '$84K', trend: { direction: 'up', value: '12.5%', label: 'vs last month', },});// "Revenue\n$84K ↑ 12.5% vs last month" Copy
import { renderStat } from 'blessed-components/stat';renderStat({ label: 'Revenue', value: '$84K', trend: { direction: 'up', value: '12.5%', label: 'vs last month', },});// "Revenue\n$84K ↑ 12.5% vs last month"
renderStat({ label: 'Overall', layout: 'inline', unit: '%', value: 85,});// "Overall 85%" Copy
renderStat({ label: 'Overall', layout: 'inline', unit: '%', value: 85,});// "Overall 85%"
Renders a deterministic text representation of one important metric.
This function is framework-independent. Import it from
blessed-components/statto keep Blessed outside the module graph.Stacked output:
Inline output: