# The legend block

The legend block contains information on how the legend will be displayed for this visualization.

Take a look at [the legends section](https://developers.felt.com/felt-style-language/legends) to see how it works.

These are the fields that each legend block can contain:

| Field name    | Description                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `displayName` | <p>Optional.<br><br>In categorical visualizations, a dictionary that maps from each category to what will be displayed on the legend.<br><br>In <a href="../types-of-visualizations/numeric-visualizations-color-and-size">numeric</a> or <a href="../types-of-visualizations/heatmaps">heatmap</a> visualizations, a dictionary that maps from the index of each class to what will be displayed on the legend.</p> |

{% code title="Example of a categorical legend" %}

```jsx
"legend": {
  "displayName": {
    "category-1": "Category 1",
    "category-2": "Category 2"
  }
}
```

{% endcode %}

{% code title="Example of a numerical legend" %}

```jsx
"legend": {
  "displayName": {
    "0": "-0.5", 
    "1": "0.5"
  }
}
```

{% endcode %}
