How To: Create multiline labels in ArcGIS Online Map Viewer
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 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.
- 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.
- In the Label features pane, click Add label class.
- Under Label field, click the Use expression icon.
- In the editor window, in the Expression box, highlight the content and press Delete to clear the box.
- Build the expression.
- Click Globals, and click $feature["<field 1>"]. In this example, it is $feature["Office_Size"].
- Type +.
- Click Constants, and click TextFormatting.NewLine to add a line break.
- Type +.
- Click Globals, and click $feature["<field 2>"]. In this example, it is $feature["Contact_Number"].
- 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 map below displays the office branches in California labeled with their respective office sizes and contact numbers on separate lines.
- FAQ: Is it possible to create multiline labels in ArcGIS Online?
- ArcGIS Online: Configure labels (Map Viewer)
- ArcGIS Arcade: Constants
Last Published: 6/10/2021
Article ID: 000025694