Skip to content

Renderer

Renderers are the communication interface with your Listr.

There are five main renderers, which are default, simple, verbose, and silent as well as a testing renderer called test.

DefaultRenderer is the default choice.

If the environment advertises itself as non-TTY it will fall back to the fallback renderer automatically.

SimpleRenderer is an alternative to DefaultRenderer, which has all its capabilities but does not try to update your vt100 compatible terminal if you are not using prompts. From v6.0.0 it is designated as the default choice for the fallback renderer.

VerboseRenderer was the default choice for the fallback renderer prior to v6.0.0. It is a fully text-based renderer.

SilentRenderer is used for the Subtask of Task since the parent already started a renderer. This renderer can also be used for using listr2 as only a task list without any output to the terminal directly, so you could use your method of communication, or a logger however you like it.

TestRenderer can be used for tests, where it will only output JSON output per-line for specific events that happen throughout the render.

Listr and Subtask Renderer Options and Per Task Renderer Options

Renderers can have global options, which it is set through rendererOptions, can be modified for a certain Subtask, and per Task options, which are injected inside the Task as options.

Depending on the selected renderer, rendererOptions as well as the options in the Task will change accordingly.

For also configuring the fallbackRenderer, you can pass fallbackRendererOptions to Listr.