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

    Function renderProgressBar

    • Renders a deterministic, single-line progress bar.

      This function is framework-independent and does not import Blessed. Import it from blessed-components/progress-bar when only string rendering is needed; that subpath keeps the Blessed adapter out of the module graph.

      The result has this structure:

      [label + space][fixed-width track][space][formatted value]
      

      Parameters

      Returns string

      A plain terminal string. No ANSI sequences or Blessed tags are added.

      RangeError Thrown when width is not a positive integer.

      RangeError Thrown when min or max is not finite, or when max is not greater than min.

      RangeError Thrown when value is not finite.

      import { renderProgressBar } from 'blessed-components/progress-bar';

      const output = renderProgressBar({
      label: 'Quality',
      value: 78,
      width: 16,
      });

      // "Quality ████████████░░░░ 78%"
      const output = renderProgressBar({
      characters: { filled: '#', empty: '-' },
      formatValue: ({ value }) => `${value} files`,
      label: 'Uploaded',
      value: 25,
      width: 8,
      });

      // "Uploaded ##------ 25 files"