Skip to content
ESM
import "@arcgis/map-components/components/arcgis-feature-templates-legacy";
Inheritance:
ArcgisFeatureTemplatesLegacyPublicLitElement
Since
ArcGIS Maps SDK for JavaScript 5.0

This is a legacy component. It relies on an underlying widget as part of our migration to native web components.

A fully native replacement for this component is in development. Once it reaches feature parity, the legacy component will be deprecated and no longer maintained. At that point, development should use the native component.

The FeatureTemplates component is part of an editing workflow. Its main purpose is to display FeatureLayer templates from one or more feature layers.

Properties

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

disabledItemFunction

Property
Type
DisabledItemFunction

A function that can be defined to disable specific template items within the component. The function takes an object containing a layer and template. If the function returns true, the item is disabled.

filterText

Property
Type
string

Text used to filter items.

Attribute
filter-text
Default value
""

headingLevel

Property
Type
HeadingLevel
Since
ArcGIS Maps SDK for JavaScript 4.20

Indicates the heading level to use for the labels of grouped feature templates. By default, the group label is rendered as a level 4 heading (e.g. <h4>Group label</h4>). 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
4
Example
// Group label will render as an <h3>
featureTemplates.headingLevel = 3;

hideFilter

Property
Type
boolean

Indicates whether the templates filter displays.

Attribute
hide-filter
Default value
false

icon

autocast Property
Type
Icon["icon"]

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
"list-rectangle"

items

readonly Property
Type
Array<TemplateItem | TemplateItemGroup>

label

Property
Type
string

The component's default label.

Attribute
label

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

selectedItem

readonly Property
Type
TemplateItem | undefined

selectionMode

Property
Type
"single" | "none" | null | undefined

Specifies the selection behavior of list items. The "single" selection mode keeps the clicked list item selected. Whereas, "none" does not preserve the selection after clicking the list item.

Attribute
selection-mode
Default value
"none"

state

readonly Property
Type
FeatureTemplatesViewModelState

The current state of the component.

Default value
"disabled"

view

Property
Type
MapViewOrSceneView | null | undefined

A reference to the MapView or SceneView.

Methods

MethodSignature
componentOnReady
inherited
componentOnReady(): Promise<this>
destroy(): Promise<void>
select(item: null | undefined | TemplateItem): 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 arcgisFeatureTemplatesLegacy = document.querySelector("arcgis-feature-templates-legacy");
document.body.append(arcgisFeatureTemplatesLegacy);
await arcgisFeatureTemplatesLegacy.componentOnReady();
console.log("arcgis-feature-templates-legacy is ready to go!");

destroy

Method
Signature
destroy (): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

select

Method
Signature
select (item: null | undefined | TemplateItem): void

Selects the template item to use.

Parameters
ParameterTypeDescriptionRequired
item

The template item to select.

Returns
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

arcgisSelect

Event
arcgisSelect: CustomEvent<SelectEvent>
bubbles composed cancelable

Type definitions

DisabledItemFunction

Type definition
Parameters
ParameterTypeDescriptionRequired
params
Pick<TemplateItem, "layer" | "template">
Returns
boolean