This is documentation for the next version of Grafana documentation. For the latest stable release, go to the latest version.

Grafana Cloud Enterprise Open source

Text

Note

The new text panel is currently in public preview. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.

To use this feature, enable the grafana.newTextPanel and text.newFeatures feature toggles in your Grafana configuration file or contact Support.

For information about the generally available experience, refer to the latest OSS documentation.

Text visualizations let you include text, HTML, code blocks, or Mermaid diagrams in your dashboards. You can use them to add contextual information and descriptions or to embed complex HTML. With text visualizations, you can build things like lightweight data-driven tables, cards, lists, and status summaries.

The following images show different uses of the text visualization.

Here, text visualizations use Markdown and HTML modes:

Text visualizations in Markdown and HTML mode

In this example, one text visualization is in TypeScript mode and the other is using Handlebars templating:

Text visualizations in TypeScript mode and using Handlebars templating

Finally, this image shows one text visualization using per row render mode and another using pagination:

Text visualizations using per row render mode and pagination
Give it a try using Grafana Play
Give it a try using Grafana Play

With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development. This feature can be seen on Text Panel.

Use a text visualization when you need to:

  • Add important links or useful annotations.
  • Provide instructions or guidance on how to interpret different panels, configure settings, or take specific actions based on the displayed data.
  • Announce any scheduled maintenance or downtime that might impact your dashboards.

Text visualization editor

The editor is where you enter and preview the content of a text visualization. It’s where you set text modes, like Markdown, HTML, or a specific coding language. Additionally, it provides formatting options and syntax highlighting, as well as variable and diagram support.

To learn more, click the following links:

Views

The editor provides three views:

  • Preview: See only the preview block.
  • Split: See the authoring and preview blocks at the same time.
  • Write: See only the authoring block.

Toolbar

The toolbar provides formatting options for common Markdown and HTML operations, like bold or italic text and lists. You can also insert:

  • Tables
  • Mermaid diagrams
  • Dashboard variables

Dashboard variables autocomplete as you enter them, and they’re interpolated in the content.

The options displayed in the formatting toolbar depend on whether you select Markdown or HTML.

Modes

The visualization mode determines how embedded content appears. Choose from:

  • Markdown: Formats the content as Markdown.
  • HTML: Renders the content as sanitized HTML. If you require more direct control over the output, you can set the disable_sanitize_html flag which enables you to directly enter HTML.
  • Code: Renders content inside a read-only code editor. Variables in the content are expanded for display. The code options are: Go, HTML, JSON, Markdown, Plain text, SQL, TypeScript, XML, YAML.

The editor provides syntax highlighting in the authoring block.

Note

To allow embedding of iframes and other websites, you need set allow_embedding = true in your Grafana config.ini or environment variables, depending on your deployment.

Render query results as text with Handlebars templates

Use ${__value}, ${__field}, ${__series}, and ${__data} macros to reference query results in the visualization content, and Handlebars templating for more control. Choose what data to display, repeat content for each row with {{#each}}, and add if/then logic with {{#if}} helpers.

Text visualization with Handlebars support

Configuration options

The following section describes the configuration options available in the panel editor pane for this visualization. These options are, as much as possible, ordered as they appear in Grafana.

Panel options

In the Panel options section of the panel editor pane, set options like the panel title, description, and show/hide rules. To learn more, refer to Configure panel options.

OptionDescription
TitleText entered in this field appears at the top of your panel in the panel editor and in the dashboard. You can use variables you have defined or global variables.
DescriptionAdd a description to a panel to share with users any important information about it, such as its purpose. Text entered in this field appears in a tooltip in the upper-left corner of the panel. Conversely, toggle on the Use as subtitle switch to display the description just below the panel title instead. You can use variables you have defined or dashboard-scoped global variables (such as $__from, $__to, $__dashboard, $__org, and $__user). Query-scoped global variables (such as $__interval and $__interval_ms) are not available in this field.
Transparent backgroundToggle this switch on and off to control whether or not the panel has the same background color as the dashboard.
Panel linksAdd links to the panel to create shortcuts to other dashboards, panels, and external websites. Access panel links by clicking the icon next to the panel title.
Repeat optionsSet whether to repeat the panel for each value in the selected variable.
Show/hide rulesSet whether to show or hide panels based on various rules.

Data options

Use the following options to control how data is rendered in the text visualization.

Render mode

Select a render mode to control how your template is applied:

  • Once: Render the whole result.
  • Per row: Each row in the data gets its own repeated block of content.

You can also select which data frame to display.

Text visualization with Render mode set to per row

Page size

When a query returns many rows, pagination lets you move through the full result instead of showing only a limited number of rows. Grafana automatically adjusts the number of rows on each page to fit the panel or you can set a range from 1-1000 rows.

This option only displays when you set Render mode to Per row and when there are 100 rows or more.

Value mappings

Value mapping is a technique you can use to change how data appears in a visualization.

For each value mapping, set the following options:

  • Condition - Choose what’s mapped to the display text and (optionally) color:
    • Value - Specific values
    • Range - Numerical ranges
    • Regex - Regular expressions
    • Special - Special values like Null, NaN (not a number), or boolean values like true and false
  • Display text
  • Color (Optional)
  • Icon (Canvas only)

To learn more, refer to Configure value mappings.

Thresholds

A threshold is a value or limit you set for a metric that’s reflected visually when it’s met or exceeded. Thresholds are one way you can conditionally style and color your visualizations based on query results.

For each threshold, set the following options:

OptionDescription
ValueSet the value for each threshold.
Thresholds modeChoose from Absolute and Percentage.

To learn more, refer to Configure thresholds.

Field overrides

Overrides allow you to customize visualization settings for specific fields or series. When you add an override rule, it targets a particular set of fields and lets you define multiple options for how that field is displayed.

Choose from the following override options:

OptionDescription
Fields with nameSelect a field from the list of all available fields.
Field with name matching regexSpecify fields to override with a regular expression.
Fields with typeSelect fields by type, such as string, numeric, or time.
Fields returned by querySelect all fields returned by a specific query, such as A, B, or C.
Fields with valuesSelect all fields returned by your defined reducer condition, such as Min, Max, Count, Total.

To learn more, refer to Configure field overrides.