blessed-components - v1.20.0
    Preparing search index...

    Function renderStat

    • 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.

      Stacked output:

      [label]
      [value][unit] [optional trend]
      [optional description]
      

      Inline output:

      [label] [value][unit] [optional trend]
      [optional description]
      

      Parameters

      Returns string

      Plain text without ANSI sequences or Blessed tags.

      RangeError Thrown when a numeric primary or trend value is not finite.

      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"
      renderStat({
      label: 'Overall',
      layout: 'inline',
      unit: '%',
      value: 85,
      });
      // "Overall 85%"