Skip to content
ESM
import "@arcgis/coding-components/components/arcgis-arcade-editor";
Inheritance:
ArcgisArcadeEditorPublicLitElement

Arcade is a portable, and lightweight expression language used to create custom content throughout the ArcGIS system. Like other expression languages, it can perform mathematical calculations, format text, and evaluate logical statements. It also supports multi-statement expressions, variables, and flow control statements. Arcade is unique when compared to other expression and scripting languages due to its inclusion of feature and geometry data types.

Map Viewer (MV) was the first ArcGIS Online product to incorporate the new Arcade editor after the editor's introduction in the November 2022 ArcGIS Online release. This was possible thanks to the Arcade editor component, which enabled MV to implement its own Arcade expression builder. You can now also find the editor in ArcGIS Dashboards, ArcGIS Field Maps, and ArcGIS Velocity.

You can easily get your own dedicated Arcade expression builder with the Arcade editor component, which includes:

Demo

Properties

PropertyAttributeType
Editor.IEditorOptions & Editor.IGlobalEditorOptions | undefined
hide-documentation-actions
hide-side-bar
openedSidePanel
reflected
opened-side-panel
script
side-action-bar-expanded
ApiSnippet[] | undefined

editorOptions

Property
Type
Editor.IEditorOptions & Editor.IGlobalEditorOptions | undefined

Options to update on the editor. For example:

{
"fontSize": 18
}

To get the full list of available options, see the Monaco Editor options documentation for more details.

hideDocumentationActions

Property
Type
boolean

If true, it will hide the documentation action in the side panel

Attribute
hide-documentation-actions
Default value
false

hideSideBar

Property
Type
boolean

If true, it will hide the side actions bar. The editor will be in a minimalistic UX.

Attribute
hide-side-bar
Default value
false

openedSidePanel

reflected Property
Type
string

The name of the opened side panel. 'none' means 'no panel opened'.

Attribute
opened-side-panel
Default value
"none"

profile

Property
Type
IEditorProfileDefinition | IPredefinedProfile | undefined

The profile contains metadata used by the editor for editing context and help. Example:

{
bundles: ["core", "dataAccess", "geometry", "portal-access"],
variables: [
{
name: "$feature",
description: "The feature passed to the script during execution.",
definition: aFeatureLayerInstance
}
]
}

script

Property
Type
string

The arcade script. Use this property to define or update the script.

Attribute
script
Default value
""

sideActionBarExpanded

reflected Property
Type
boolean

If true, the side action bar will be expanded

Attribute
side-action-bar-expanded
Default value
false

snippets

Property
Type
ApiSnippet[] | undefined

Collection of snippets

suggestions

Property
Type
IEditorCodeSuggestion[] | IEditorCodeSuggestionGroup[] | undefined

Collection of suggestions

testData

Property
Type
IEditorTestContext | undefined

Test data used to execute the script in the editor. If undefined the execute script UX will be hidden.

Methods

MethodSignature
componentOnReady
inherited
componentOnReady(): Promise<this>
setFocus(): Promise<void>

componentOnReady

inherited Method
Signature
componentOnReady (): Promise<this>
Inherited from: PublicLitElement

Creates a promise that resolves once the component is fully loaded.

Returns
Promise<this>
Example
const arcgisArcadeEditor = document.querySelector("arcgis-arcade-editor");
document.body.append(arcgisArcadeEditor);
await arcgisArcadeEditor.componentOnReady();
console.log("arcgis-arcade-editor is ready to go!");

setFocus

Method
Signature
setFocus (): Promise<void>

Set the focus on the element.

Returns
Promise<void>

Events

arcgisDiagnosticsChange

Event
arcgisDiagnosticsChange: CustomEvent<Diagnostic[]>

Emitted when the diagnostics collection has changed.

composed cancelable

arcgisScriptChange

Event
arcgisScriptChange: CustomEvent<string>

Emitted when the script string has changed.

composed cancelable