Skip to content

Features

ESM:
Use dark colors for code blocksCopy
1
import "@arcgis/map-components/components/arcgis-features";
CDN:
No specific import is needed for this component.
Since:ArcGIS Maps SDK for JavaScript 4.28

The Features component allows users to view a feature's popupTemplate content such as attributes, actions, related records, etc., without having to be tied to a arcgis-map or arcgis-scene component. This component looks and behaves similarly to the arcgis-popup component, however unlike Popup, the Features component can be placed outside of the map or scene component. For example, when features are selected in the arcgis-map, the arcgis-popup opens within the map whether it is docked or anchored to the selected feature. With the Features component, the same information that Popup provides is shown in a separate container from the map, such as a HTML div within a Calcite Design System Shell Panel.

If multiple features are passed into the Features component, the component provides buttons to page though the features and a feature menu that allows the list of features to be displayed so the user can choose which feature content to display in the component. The component also respects feature reduction PopupTemplates for binning and clustering.

The Features component should be used if needing to use the Popup functionality outside of the map or scene component. If wanting to show a single feature's content without actions, related records, clustering configuration, etc., then use the arcgis-feature component.

See also

Demo

Properties

PropertyAttributeType
actionsCollection<ActionButton | ActionToggle>
active
readonly
boolean
autoDestroyDisabledauto-destroy-disabledboolean
closed
deprecated
closedboolean
collapsedcollapsedboolean
contentcontentHTMLElement | Widget | string
defaultPopupTemplateEnableddefault-popup-template-enabledboolean
featureCount
readonly
number
featureMenuOpenfeature-menu-openboolean
featureMenuTitlefeature-menu-titlestring
featureNavigationTopfeature-navigation-topboolean
featuresArray<Graphic>
featuresPerPagefeatures-per-pagenumber
featuresTitle
deprecated
features-titlestring
featureViewModelAbilitiesAbilities
goToOverride(((view: MapView | SceneView, goToParameters: GoToParameters) => void))
headerActionsCollection<ActionButton | ActionToggle>
headingheadingstring
headingLevelheading-level1 | 2 | 3 | 4 | 5 | 6
hideActionBarhide-action-barboolean
hideCloseButtonhide-close-buttonboolean
hideFeatureListLayerTitlehide-feature-list-layer-titleboolean
hideFeatureMenuHeadinghide-feature-menu-headingboolean
hideFeatureNavigationhide-feature-navigationboolean
hideFlowhide-flowboolean
hideHeadinghide-headingboolean
hideSpinnerhide-spinnerboolean
highlightDisabledhighlight-disabledboolean
iconiconstring
includeDefaultActionsDisabledinclude-default-actions-disabledboolean
initialDisplayModeinitial-display-mode"feature" | "list"
labellabelstring
mapMap
messageOverridesRecord<string, unknown>
position
deprecated
position"bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
promisesArray<Promise<Array<Graphic>>>
referenceElementreference-elementHTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | string
Graphic
Graphic
HTMLArcgisFeatureElement
selectedFeatureIndexselected-feature-indexnumber
showCollapseButtonshow-collapse-buttonboolean
spatialReferenceSpatialReference
state
readonlyreflected
state"disabled" | "ready"
timeZonetime-zonestring
viewMapView | SceneView
viewModelFeaturesViewModel
visiblevisibleboolean

actions

Property

Collection of action or action toggle objects displayed in the action bar. Each action may be executed by clicking the icon or image symbolizing them. By default, every component has a Zoom To action styled with a magnifying glass icon. When this icon is clicked, the map zooms in four LODs and centers on the selected feature. This default action can be removed by setting includeDefaultActionsDisabled to true, or by setting the overwriteActions property to true in the PopupTemplate. The order of each action is the order in which they appear in the actions Collection. The arcgisTriggerAction event fires each time an action is clicked. Actions are defined with the properties listed in the ActionButton or ActionToggle class.

See also
Example
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
// Defines an action button to zoom out from the selected feature
const zoomOutAction = {
  type: "button",
  // This text is displayed as a tooltip
  title: "Zoom out",
  // The ID by which to reference the action in the event handler
  id: "zoom-out",
  // Sets the icon used to style the action button
  icon: "magnifying-glass-minus"
};
// Adds the custom action to the Features component's actions collection.
featuresComponent.actions.push(zoomOutAction);

active

readonlyProperty
active: boolean

Indicates if the component is active when it is visible and is not waiting for results.

Default value
false

autoDestroyDisabled

Property
autoDestroyDisabled: 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

closed

deprecatedProperty
closed: boolean
Deprecatedsince 4.34, use visible instead.

Indicates whether a component is closed. When true, the component will be hidden.

Attribute
closed
Default value
false

collapsed

Property
collapsed: boolean

Indicates whether the component displays its content. If true, only the header displays. This property is only honored if showCollapsed is true.

Attribute
collapsed
Default value
false

content

Property
content: HTMLElement | Widget | string

The content of the Features component. When set directly on the component, this content is static and cannot use fields to set content templates. To set a template for the content based on field or attribute names, see PopupTemplate.content.

Example
Use dark colors for code blocksCopy
1
2
3
// This sets generic instructions in the component that will always be displayed
// unless it is overridden by a PopupTemplate.
featuresComponent.content = "Click a feature on the map to view its attributes";
Attribute
content

defaultPopupTemplateEnabled

Property
defaultPopupTemplateEnabled: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, defaultPopupTemplateEnabled added at 4.34.

Enables automatic creation of a popup template for layers that have popups enabled but no popupTemplate defined.

Read more...

Attribute
default-popup-template-enabled
Default value
false

featureCount

readonlyProperty
featureCount: number
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, featureCount added at 4.34.

The number of selected features available to the popup.

Default value
0

featureMenuOpen

Property
featureMenuOpen: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, featureMenuOpen added at 4.34.

This property enables multiple features in the component to display in a list rather than displaying the first selected feature. Setting this to true allows the user to scroll through the list of features. This value will only be honored if initialDisplayMode is set to "feature".

Attribute
feature-menu-open
Default value
false

featureMenuTitle

Property
featureMenuTitle: string
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, featureMenuTitle added at 4.34.

Sets the title to display on the component while viewing the feature menu.

Attribute
feature-menu-title

featureNavigationTop

Property
featureNavigationTop: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, featureNavigationTop added at 4.34.

Indicates whether the feature navigation arrows are displayed at the top of the component. By default, the navigation arrows are displayed at the bottom of the component.

Attribute
feature-navigation-top
Default value
false

features

Property
features: Array<Graphic>

An array of features associated with the Features component. Each graphic in this array must have a valid PopupTemplate set. They may share the same PopupTemplate or have unique PopupTemplates depending on their attributes. The content and heading of the component is set based on the content and title properties of each graphic's respective PopupTemplate.

When more than one graphic exists in this array, the current content of the component is set based on the value of the selected feature.

This value is null if no features are associated with the component.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
// When setting the features property, the graphics pushed to this property
// must have a PopupTemplate set.
let g1 = new Graphic();
g1.popupTemplate = new PopupTemplate({
  title: "Results title",
  content: "Results: {ATTRIBUTE_NAME}"
});
// Set the graphics as an array to the Features component instance. The content and title of
// the component will be set depending on the PopupTemplate of the graphics.
// Each graphic may share the same PopupTemplate or have a unique PopupTemplate
let graphics = [g1, g2, g3, g4, g5];
featuresComponent.features = graphics;

featuresPerPage

Property
featuresPerPage: number

The number of features to fetch at one time.

Attribute
features-per-page
Default value
20

featuresTitle

deprecatedProperty
featuresTitle: string
Deprecatedsince 4.34, use heading instead.

The title of the Features component.

Attribute
features-title

featureViewModelAbilities

Property
featureViewModelAbilities: Abilities

Defines the specific abilities that can be used when querying and displaying content.

goToOverride

Property
goToOverride: (((view: MapView | SceneView, goToParameters: GoToParameters) => void))

This function provides the ability to override either the arcgis-map.goTo or arcgis-scene.goTo methods.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
6
features.goToOverride = (map, goToParams)=>  {
  goToParams.options = {
    duration: updatedDuration
  };
  return map.goTo(goToParams.target, goToParams.options);
};

headerActions

Property

The actions that are displayed in the header of the component.

heading

Property
heading: string
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, heading added at 4.34.

The title of the Features component. This can be set to any string value no matter the features that are selected. If the selected feature has a PopupTemplate, then the title set in the corresponding template is used here.

See also
Example
Use dark colors for code blocksCopy
1
2
3
// This title will display in the component unless a selected feature's
// PopupTemplate overrides it.
featuresComponent.title = "Population by zip codes in Southern California";
Attribute
heading

headingLevel

Property
headingLevel: 1 | 2 | 3 | 4 | 5 | 6

Indicates the heading level to use for the heading of the component. By default, the heading is rendered as a level 2 heading (e.g. <h2>Popup title</h2>). 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.

Attribute
heading-level
Default value
2

hideActionBar

Property
hideActionBar: boolean

Indicates whether to hide the action bar that holds the feature's actions.

Attribute
hide-action-bar
Default value
false

hideCloseButton

Property
hideCloseButton: boolean

Indicates whether to hide the close button in the component.

Attribute
hide-close-button
Default value
false

hideFeatureListLayerTitle

Property
hideFeatureListLayerTitle: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, hideFeatureListLayerTitle added at 4.34.

Indicates whether to hide the group heading for a list of multiple features.

Attribute
hide-feature-list-layer-title
Default value
false

hideFeatureMenuHeading

Property
hideFeatureMenuHeading: boolean

Indicates whether to hide the feature menu heading and description in the component's feature menu list.

Attribute
hide-feature-menu-heading
Default value
false

hideFeatureNavigation

Property
hideFeatureNavigation: boolean

Indicates whether to hide the feature pagination in the component. This allows the user to scroll through various selected features using pagination arrows.

Attribute
hide-feature-navigation
Default value
false

hideFlow

Property
hideFlow: boolean

Determines whether the component should be shown within its built-in flow component or if the flow component should be excluded. The component will be displayed within its original flow component if set to false. The flow component will be omitted from the component if set to true. To place the component into an existing Calcite flow component, set this property to false.

Attribute
hide-flow
Default value
false

hideHeading

Property
hideHeading: boolean

Indicates whether to hide the component's heading.

Attribute
hide-heading
Default value
false

hideSpinner

Property
hideSpinner: boolean

Indicates whether to hide the component's loading spinner.

Attribute
hide-spinner
Default value
false

highlightDisabled

Property
highlightDisabled: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, highlightDisabled added at 4.34.

Indicates whether to highlight the selected feature in the associated arcgis-map or arcgis-scene component.

Attribute
highlight-disabled
Default value
false

icon

Property
icon: string

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

includeDefaultActionsDisabled

Property
includeDefaultActionsDisabled: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, includeDefaultActionsDisabled added at 4.34.

Indicates whether to include the default actions in the component. In order to disable any default actions, it is necessary to set includeDefaultActionsDisabled to true.

Attribute
include-default-actions-disabled
Default value
false

initialDisplayMode

Property
initialDisplayMode: "feature" | "list"

Indicates whether to initially display a list of features, or the content for one feature.

Attribute
initial-display-mode
Default value
"feature"

label

Property
label: string

The component's default label.

Attribute
label

map

Property
map: Map

A map is required when the input features have 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.

Alternatively, the view property can be used to provide the map instance for this property.

See also
Example
Use dark colors for code blocksCopy
1
2
// The building footprints represent the buildings that intersect a clicked parcel
let buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints"));
Default value
null

messageOverrides

Property
messageOverrides: Record<string, unknown>
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, messageOverrides added at 4.34.

Replace localized message strings with your own strings.

Note: Individual message keys may change between releases.

position

deprecatedProperty
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
Deprecatedsince 4.34, use slot instead.
Attribute
position

promises

Property
promises: Array<Promise<Array<Graphic>>>

An array of pending Promises that have not yet been fulfilled. If there are no pending promises, the value is null. When the pending promises are resolved they are removed from this array and the features they return are pushed into the features array.

referenceElement

Property

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

selectedDrillInFeature

readonlyProperty
selectedDrillInFeature: Graphic
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, selectedDrillInFeature added at 4.34.

The feature that the component has drilled into. This feature is either associated with the selected feature in a relationship or utility network element.

selectedFeature

readonlyProperty
selectedFeature: Graphic

The selected feature accessed by the Features component. The content displayed in the component is determined based on the PopupTemplate assigned to this feature.

selectedFeatureComponent

readonlyProperty
selectedFeatureComponent: HTMLArcgisFeatureElement
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, selectedFeatureComponent added at 4.34.

Returns a reference to the current arcgis-feature component. This is useful if needing to get a reference to the Feature component in order to make any changes to it.

selectedFeatureIndex

Property
selectedFeatureIndex: number

Index of the feature that is selected. When features are set, the first index is automatically selected.

Attribute
selected-feature-index

showCollapseButton

Property
showCollapseButton: boolean

Indicates whether to show the collapse button in the component.

Attribute
show-collapse-button
Default value
false

spatialReference

Property
spatialReference: SpatialReference

The spatial reference used for Arcade operations. This property should be set if the Features component executes Arcade expressions that contain geometry functions.

Alternatively, the view property can be used to provide the spatial reference instance for this property.

See also
Default value
null

state

readonlyreflected
Property
state: "disabled" | "ready"

The current state of the component.

Attribute
state
Default value
"disabled"

timeZone

Property
timeZone: string

Dates and times displayed in the component will be displayed in this time zone. By default this time zone is inherited from arcgis-map.timeZone if the view property is set. When a MapView is not associated with the component then the property will fallback to the system time zone.

Possible Values

  • system: Dates and times will be displayed in the timezone of the device or browser.
  • unknown: Dates and time are not adjusted for any timezone.
  • Specified IANA timezone: Dates and times will be displayed in the specified IANA time zone. See wikipedia - List of tz database time zones.
Attribute
time-zone

view

Property
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, view added at 4.34.

A reference to the MapView or SceneView. The Features component requires a view to be set if:

viewModel

Property
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, viewModel added at 4.34.

visible

Property
visible: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, visible added at 4.34.

Indicates whether the popup is visible. This property is true when the popup is querying for results, even if it is not open in the view. Use the property to check if the component is visible.

Attribute
visible
Default value
false

Methods

MethodSignature
clearclear(): Promise<void>
closeclose(): Promise<void>
componentOnReadycomponentOnReady(): Promise<void>
destroydestroy(): Promise<void>
fetchFeaturesfetchFeatures(screenPoint: __esri.ScreenPoint, options?: __esri.FetchFeaturesOptions): Promise<__esri.FetchPopupFeaturesResult>
nextnext(): Promise<FeaturesViewModel>
openopen(options?: __esri.FeaturesViewModelOpenOptions): Promise<void>
previousprevious(): Promise<FeaturesViewModel>
setFocussetFocus(): Promise<void>
triggerActiontriggerAction(action: __esri.ActionButton | __esri.ActionToggle): Promise<void>

clear

Method
clear(): Promise<void>

Removes promises, features, content, and heading from the Features component.

Returns
Promise<void>

close

Method
close(): Promise<void>

A convenience method to close the component.

Returns
Promise<void>

componentOnReady

Method
componentOnReady(): Promise<void>

Create a promise that resolves once component is fully loaded.

Example
Use dark colors for code blocksCopy
1
2
3
4
const arcgisFeatures = document.querySelector("arcgis-features");
document.body.append(arcgisFeatures);
await arcgisFeatures.componentOnReady();
console.log("arcgis-features is ready to go!");
Returns
Promise<void>

destroy

Method
destroy(): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

fetchFeatures

Method
fetchFeatures(screenPoint: __esri.ScreenPoint, options?: __esri.FetchFeaturesOptions): Promise<__esri.FetchPopupFeaturesResult>

Use this method to return feature(s) at a given screen location. These features are fetched from all of the layer in the view. In order to use this, a layer must already have an associated PopupTemplate. This method allows a developer to control how the input location is handled.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Use reactiveUtils to watch the map's click event.
reactiveUtils.on(() => map, "arcgisViewClick",
(event) => {
  // Call fetchFeatures and pass in the click event screenPoint
  featuresComponent.fetchFeatures(event.screenPoint).then((response) => {
    // Access the response from fetchFeatures
    response.allGraphicsPromise.then((graphics) => {
    // If there are no graphics in the click event, then make sure
    // the Features component is not showing.
      if(graphics.length === 0){
        featuresComponent.visible = false;
      }
      // If graphics do exist, set the Features component features property to the returned
      // graphics from fetchFeatures.
      else{
        featuresComponent.features = graphics;
      }
    });
  });
Parameters
ParameterTypeOptional?
screenPointScreenPoint
optionsFetchFeaturesOptions | undefined
Returns
Promise<FetchPopupFeaturesResult>

next

Method
next(): Promise<FeaturesViewModel>

Selects the feature at the next index in relation to the selected feature.

See also
Returns
Promise<FeaturesViewModel>

open

Method
open(options?: __esri.FeaturesViewModelOpenOptions): Promise<void>

Opens the Features component with content defined either explicitly with content or driven from the PopupTemplate of input features.

Examples
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
// Use reactiveUtils to watch the map component's click event.
reactiveUtils.on(() => viewElement, "arcgisViewClick", (event) => {
  const { mapPoint } = event.detail;
  featuresComponent.open({
    // Title and content displayed in the component
    title: `Click location: (${mapPoint.x},${mapPoint.y})`,
    content: "This is the default content displayed on click."
  });
});
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
// The Features component must have a reference element set on the component along with the
// location property to fetch features.
// Use reactiveUtils to watch the map component's click event.
reactiveUtils.on(() => viewElement, "arcgisViewClick", (event) => {
  const { mapPoint } = event.detail;
  featuresComponent.open({
    location: mapPoint,
    // Display the content for the selected feature(s) if a popupTemplate is defined.
    fetchFeatures: true
  });
});
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
// Open the Features component with a specified array of graphics that already
// have a PopupTemplate set and display the feature menu when it opens.
featuresComponent.open({
  // array of graphics
  features: graphics,
  // selected features initially display in a list
  featureMenuOpen: true
});
Parameters
ParameterTypeOptional?
optionsFeaturesViewModelOpenOptions | undefined
Returns
Promise<void>

previous

Method
previous(): Promise<FeaturesViewModel>

Selects the feature at the previous index in relation to the selected feature.

See also
Returns
Promise<FeaturesViewModel>

setFocus

Method
setFocus(): Promise<void>
Since:ArcGIS Maps SDK for JavaScript 4.34Features since 4.28, setFocus added at 4.34.

Use this method to give focus to the Component if the component is able to be focused.

Returns
Promise<void>

triggerAction

Method
triggerAction(action: __esri.ActionButton | __esri.ActionToggle): Promise<void>

Triggers the arcgisTriggerAction event and executes the action at the specified index in the actions array.

Parameters
ParameterTypeOptional?
actionActionButton | ActionToggle
Returns
Promise<void>

Events

EventType
arcgisCloseCustomEvent<void>
arcgisPropertyChangeCustomEvent<{ name: "state" | "active" | "collapsed" | "featureCount" | "visible" | "selectedFeature" | "featureMenuOpen" | "features" | "promises" | "selectedFeatureIndex" | "selectedDrillInFeature" | "selectedFeatureComponent"; }>
arcgisReadyCustomEvent<void>
arcgisTriggerActionCustomEvent<FeaturesViewModelTriggerActionEvent>

arcgisClose

Event
arcgisClose: CustomEvent<void>

Emitted when the component's close button is clicked.

bubbles
composed
cancelable

arcgisPropertyChange

Event
arcgisPropertyChange: CustomEvent<{ name: "state" | "active" | "collapsed" | "featureCount" | "visible" | "selectedFeature" | "featureMenuOpen" | "features" | "promises" | "selectedFeatureIndex" | "selectedDrillInFeature" | "selectedFeatureComponent"; }>

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

arcgisTriggerAction

Event
arcgisTriggerAction: CustomEvent<FeaturesViewModelTriggerActionEvent>

Fires after the user clicks on an action in the Features component. This event may be used to define a custom function to execute when particular actions are clicked.

See also
Example
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
viewElement.addEventListener("arcgisViewClick", (event) => {
  const { mapPoint } = event.detail;
  featuresComponent.open({
    location: mapPoint,
    fetchFeatures: true,
    actions: [{
      // This text is displayed as a tooltip
      title: "Zoom out",
      // The ID used to reference this action in the event handler
      id: "zoom-out",
      // Sets the icon font used to style the action button
      icon: "magnifying-glass-minus"
    },
    {
      title: "Delete Feature",
      id: "delete-feature-action",
      icon: "trash"
    }]
  });
});

// Fires each time an action is clicked
reactiveUtils.on(()=> featuresComponent, "arcgisTriggerAction", (event)=>{
  // If the zoom-out action is clicked, execute the following code
  if(event.detail.action.id === "zoom-out"){
    // Zoom out two levels (LODs)
    viewElement.goTo({
      center: viewElement.center,
      zoom: viewElement.zoom - 2
    });
  }
});
bubbles
composed
cancelable

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.