Skip to content
ESM
import "@arcgis/map-components/components/arcgis-feature-form";
Inheritance:
ArcgisFeatureFormPublicLitElement

Demo

Properties

PropertyAttributeType
auto-destroy-disabled
disabled
edit-type
group-display
"all" | "sequential"
heading-level
hide-read-only-notice
icon
Icon["icon"]
label
map
reference-element
state
readonly
time-zone

autoDestroyDisabled

Property
Type
boolean

If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy() method when you are done to prevent memory leaks.

Attribute
auto-destroy-disabled
Default value
false

disabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

When true, the component is visually withdrawn and cannot receive user interaction.

Attribute
disabled
Default value
false

editType

Property
Type
EditType
Since
ArcGIS Maps SDK for JavaScript 4.33

The edit type for the form, which determines the editing context and behavior.

This property is used in two primary ways:

  1. Arcade Expressions Context: When evaluating Arcade expressions, the value of this property is assigned to the $editContext.editType variable. This allows Arcade expressions to adapt their behavior based on the type of edit being performed (e.g., "INSERT", "UPDATE", "DELETE", or "NA").

  2. Layer Editing Capabilities: This property is also used to determine whether the layer allows the specified type of edit. For example:

    • If editType is set to "INSERT" but the layer has supportsAdd: false, all inputs in the form will be read-only.
    • If editType is set to "UPDATE" but the layer has supportsUpdate: false, all inputs will also be read-only.

This behavior applies regardless of whether a form template or Arcade expressions are present. For instance:

  • If a layer has { supportsAdd: true, supportsUpdate: false } and no form template, setting editType to "INSERT" will allow the user to modify all fields, while setting it to "UPDATE" will make all fields read-only.
  • If a form template is present with field elements that include editableExpression or valueExpression, the editType still determines whether the layer permits editing in the given context.
See also
Attribute
edit-type
Default value
"NA"

feature

Property
Type
Graphic | null | undefined

The associated feature containing the editable attributes. A common way to access this is via the MapView#hitTest() or SceneView's hitTest() method.

Example
// Check if a user clicked on an incident feature.
view.on("click", function(event) {
view.hitTest(event).then(function(response) {
// Display the attributes of selected incident feature in the form
if (response.results[0].graphic && response.results[0].graphic.layer.id == "incidentsLayer") {
formVM.feature = result.results[0].graphic
}
});
});

formTemplate

Property
Type
FormTemplate | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.16

The associated template used for the form.

The FormTemplate is used to configure how the form should display and set any associated properties for the form, e.g. title, description, field elements, etc.

See also
Example
// Create the Form template and pass in elements
const formTemplate = new FormTemplate({
title: "Inspector report",
description: "Enter all relevant information below",
elements: [groupElement] // Add the grouped elements to the template
});
// Add a new feature form with grouped fields
const form = new FeatureForm({
container: "form",
groupDisplay: "sequential", // only display one group at a time
formTemplate: formTemplate // set it to template created above
});

groupDisplay

Property
Type
"all" | "sequential"
Since
ArcGIS Maps SDK for JavaScript 4.10

String indicating the groupDisplay and how they will be displayed to the end user. This only applies if using grouped field elements configured in the Editor's layer infos.

Possible Values

ValueDescription
allAll groups will be expanded.
sequentialA single group will be expanded at a time.
See also
Attribute
group-display
Default value
"all"

headingLevel

Property
Type
HeadingLevel
Since
ArcGIS Maps SDK for JavaScript 4.20

Indicates the heading level to use for the FormTemplate#title of the form. By default, the title is rendered as a level 2 heading (e.g. <h2>Form title</h2>). In addition, group element labels default to a level 3 heading (e.g. <h3>Group element label</h3>). Depending on the component's placement in your app, you may need to adjust this heading for proper semantics. This is important for meeting accessibility standards.

See also
Attribute
heading-level
Default value
2
Example
// form title will render as an <h3>
// group element labels will render as an <h4>
featureForm.headingLevel = 3;

hideReadOnlyNotice

Property
Type
boolean
Attribute
hide-read-only-notice
Default value
false

icon

autocast Property
Type
Icon["icon"]
Since
ArcGIS Maps SDK for JavaScript 4.27

Icon which represents the component. Typically used when the component is controlled by another component (e.g. by the Expand component).

See also
Attribute
icon
Default value
"form-field"

label

Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 4.11

The component's default label.

Attribute
label

layer

Property
Type
FeatureFormLayerUnion | null | undefined

Layer containing the editable feature attributes. If this layer is not specified, it is the same as the graphic's layer.

Example
const form = new FeatureForm({
container: "formDiv", // HTML div
layer: featureLayer // Feature layer
});

map

Property
Type
Map | null | undefined
Since
ArcGIS Maps SDK for JavaScript 5.0

A map is required when the input layer has a popupTemplate that contains Arcade expressions in ExpressionInfo or ExpressionContent that may use the $map profile variable to access data from layers within a map. Without a map, expressions that use $map will throw an error.

See also
Default value
null
Example

// The building footprints represent the buildings that intersect a clicked parcel let buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints"));

referenceElement

Property
Type
ArcgisReferenceElement | string | undefined

By assigning the id attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.

See also
Attribute
reference-element

state

readonly Property
Type
FeatureFormViewModelState

The current state of the component.

Default value
"disabled"

timeZone

Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 4.28

The timezone displayed within the form. If unknown, it first checks if the layer has a FeatureLayer#preferredTimeZone. If so, it displays this. If not, it will default to UTC.

Attribute
time-zone

Methods

MethodSignature
componentOnReady
inherited
componentOnReady(): Promise<this>
destroy(): Promise<void>
getValues(): Promise<any>
submit(): 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 arcgisFeatureForm = document.querySelector("arcgis-feature-form");
document.body.append(arcgisFeatureForm);
await arcgisFeatureForm.componentOnReady();
console.log("arcgis-feature-form is ready to go!");

destroy

Method
Signature
destroy (): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

getValues

Method
Signature
getValues (): Promise<any>

Returns all of the field values, regardless of update status.

Returns
Promise<any>

submit

Method
Signature
submit (): Promise<void>

Fires the submit event.

Returns
Promise<void>

Events

arcgisPropertyChange

Event
arcgisPropertyChange: CustomEvent<{ name: "state"; }>

Emitted when the value of a property is changed. Use this to listen to changes to properties.

bubbles composed cancelable

arcgisReady

Event
arcgisReady: CustomEvent<void>

Emitted when the component associated with a map or scene view is ready to be interacted with.

bubbles composed cancelable

arcgisSubmit

Event
arcgisSubmit: CustomEvent<SubmitEvent>

Fires when the submit() method is called.

bubbles composed cancelable

arcgisValueChange

Event
arcgisValueChange: CustomEvent<ValueChangeEvent>

Fires when a field value is updated.

bubbles composed cancelable