HOW TO

Create multiline labels in ArcGIS Online Map Viewer

Last Published: June 10, 2021

Summary

In ArcGIS Online Map Viewer, multiline labels can be created using the Arcade custom expression builder. In this article's example, the California_Office_Branches layer contains information on the branches in California, as shown in the attribute table below.

Note:
ArcGIS Online Map Viewer Classic does not support multiline labels.
The attribute table containing the Office_Size  and Contact_Number fields of the California_Office_Branches layer.

The expression below is used to create a label displaying the Office_Size and Contact_Number field values on two separate lines for each office.

Note:
The TextFormatting.NewLine constant inserts a line break between the two fields.
$feature["Office_Size"]+TextFormatting.NewLine+$feature["Contact_Number"] 

Procedure

  1. In ArcGIS Online, open the layer in Map Viewer and enable labeling. For instructions, refer to Steps 1 through 6 of this help document: ArcGIS Online: Apply labels.
  2. In the Label features pane, click Add label class.
The Label features pane
  1. Under Label field, click the Use expression Use expression icon. icon.
The Label features with the Use expression icon displayed.
  1. In the editor window, in the Expression box, highlight the content and press Delete to clear the box.
  2. Build the expression.
    1. Click Globals, and click $feature["<field 1>"]. In this example, it is $feature["Office_Size"].
    2. Type +.
    3. Click Constants, and click TextFormatting.NewLine to add a line break.
    4. Type +.
    5. Click Globals, and click $feature["<field 2>"]. In this example, it is $feature["Contact_Number"].
    6. Click Test to verify the expression, and click OK.
Note:
Repeat Steps 5(b), (c), (d), and (e) for every added field, replacing $feature["<field 2>"] with a preferred field before clicking Test.
The editor window contains the expression to run and display the Test option to verify the expression.

The map below displays the office branches in California labeled with their respective office sizes and contact numbers on separate lines.

Map of the office branches in California labeled with office sizes and contact numbers on two separate lines.

Article ID: 000025694

Software:
  • ArcGIS Online

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options