import "@arcgis/map-components/components/arcgis-features";- Inheritance:
- ArcgisFeatures→
PublicLitElement
- 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 an 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
| Property | Attribute | Type |
|---|---|---|
| ||
active readonly | | |
auto-destroy-disabled | ||
chart-animation-disabled | ||
collapsed | ||
content | ||
default-popup-template-enabled | ||
feature-count | ||
feature-menu-open | ||
feature-menu-title | ||
feature-navigation-top | ||
| ||
features-per-page | ||
| ||
| ||
| ||
heading | ||
heading-level | ||
hide-action-bar | ||
hide-attachments-content | ||
hide-close-button | ||
hide-content | ||
hide-custom-content | ||
hide-expression-content | ||
hide-feature-list-layer-title | ||
hide-feature-menu-heading | ||
hide-feature-navigation | ||
hide-fields-content | ||
hide-heading | ||
hide-last-edited-info | ||
hide-media-content | ||
hide-relationship-content | ||
hide-spinner | ||
hide-text-content | ||
hide-utility-network-content | ||
highlight-disabled | ||
icon | ||
include-default-actions-disabled | ||
initial-display-mode | ||
label | ||
| ||
| ||
open | ||
| ||
reference-element | ||
selectedDrillInFeature readonly | | |
selectedFeature readonly | | |
selectedFeatureComponent readonly | | |
selected-feature-index | ||
show-collapse-button | ||
| ||
state readonly | | |
time-zone | ||
update-location-enabled | ||
| ||
|
actions
- Type
- Collection<PopupAction>
A collection of action button or action toggle objects. Each action may be executed by clicking the icon or image symbolizing them.
There is a default Zoom To action styled with a magnifying glass icon to zoom in four LODs and center the map on the selected feature. This default action can be removed by setting includeDefaultActionsDisabled to true, or by setting the overwriteActions property to true in a 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.
autoDestroyDisabled
- 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
chartAnimationDisabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Disables chart animation within the component.
- Attribute
- chart-animation-disabled
- Default value
- false
collapsed
- Type
- boolean
Indicates whether the component displays its content. If true, only the header displays.
This property is only honored if showCollapseButton is true.
- Attribute
- collapsed
- Default value
- false
content
The content of the 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.
- Attribute
- content
Example
// This sets generic instructions in the component that will always be displayed// unless it is overridden by a PopupTemplate.component.content = "Click a feature on the map to view its attributes"; defaultPopupTemplateEnabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Enables automatic creation of a popup template for layers that have popups enabled but no popupTemplate defined. Automatic popup templates are supported for layers that support the createPopupTemplate method.
Note: Starting with version 4.28, date fields are formatted using the short-date-short-time preset dateFormat rather than long-month-day-year in default popup created by setting the defaultPopupTemplateEnabled property to true.
For example, previously a date that may have appeared as "December 30, 1997" will now appear as "12/30/1997 6:00 PM".
- Attribute
- default-popup-template-enabled
- Default value
- false
featureMenuOpen
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 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
featureNavigationTop
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 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
An array of features associated with the 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 selectedFeature).
This value is null if no features are associated with the component.
Example
// 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 popup 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 PopupTemplatelet graphics = [g1, g2, g3, g4, g5];component.features = graphics; featuresPerPage
- Type
- number
The number of features to fetch at one time.
- Attribute
- features-per-page
- Default value
- 20
goToOverride
- Type
- GoToOverride | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.33
This function provides the ability to override either the arcgis-map.goTo() or arcgis-scene.goTo() methods.
Example
component.goToOverride = function(view, goToParams) { goToParams.options = { duration: updatedDuration }; return view.goTo(goToParams.target, goToParams.options);}; headerActions
- Type
- Collection<ActionButton | ActionToggle>
The actions that are displayed in the header of the component.
heading
- Since
- ArcGIS Maps SDK for JavaScript 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 selectedFeature has a PopupTemplate, then the title set in the corresponding template is used here.
- See also
- Attribute
- heading
Example
// This title will display in the component unless a selected feature's// PopupTemplate overrides it.featuresComponent.title = "Population by zip codes in Southern California"; headingLevel
- Type
- HeadingLevel
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
hideAttachmentsContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show attachments content within the component.
- Attribute
- hide-attachments-content
- Default value
- false
hideCloseButton
- Type
- boolean
Indicates whether to hide the close button in the component.
- Attribute
- hide-close-button
- Default value
- false
hideContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show content within the component.
- Attribute
- hide-content
- Default value
- false
hideCustomContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show custom content within the component.
- Attribute
- hide-custom-content
- Default value
- false
hideExpressionContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show expression content within the component.
- Attribute
- hide-expression-content
- Default value
- false
hideFeatureListLayerTitle
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 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
- Type
- 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
hideFieldsContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show fields content within the component.
- Attribute
- hide-fields-content
- Default value
- false
hideHeading
- Type
- boolean
Indicates whether to hide the heading in the component.
- Attribute
- hide-heading
- Default value
- false
hideLastEditedInfo
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show the last edited info within the component.
- Attribute
- hide-last-edited-info
- Default value
- false
hideMediaContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show media content within the component.
- Attribute
- hide-media-content
- Default value
- false
hideRelationshipContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show relationship content within the component.
- Attribute
- hide-relationship-content
- Default value
- false
hideSpinner
- Type
- boolean
Indicates whether to hide the spinner in the component.
- Attribute
- hide-spinner
- Default value
- false
hideTextContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show text content within the component.
- Attribute
- hide-text-content
- Default value
- false
hideUtilityNetworkContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
This property provides the ability to hide or show utility network content within the component.
- Attribute
- hide-utility-network-content
- Default value
- false
highlightDisabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Indicates whether to highlight the selectedFeature in the associated arcgis-map or arcgis-scene component.
- Attribute
- highlight-disabled
- Default value
- false
includeDefaultActionsDisabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 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
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.
- Default value
- null
Example
// The building footprints represent the buildings that intersect a clicked parcellet buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints")); open
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether the component is visible. This property is true when the component is querying for results, even if it is not open. Use this property to check if the component is visible.
- See also
- Attribute
- open
- Default value
- false
Example
// Listen for clicks on the view and open the component at the clicked location with custom content.viewElement.addEventListener("arcgisViewClick", (event) => { const { mapPoint } = event.detail; component.location = mapPoint; component.heading = "You clicked here"; component.content = "Latitude: " + mapPoint.latitude.toFixed(3) + ", Longitude: " + mapPoint.longitude.toFixed(3); component.open = true;}); promises
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
- 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.
- Attribute
- reference-element
selectedDrillInFeature
- Since
- ArcGIS Maps SDK for JavaScript 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
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
- Type
- ArcgisFeature | null
- Since
- ArcGIS Maps SDK for JavaScript 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
- Type
- number
Index of the feature that is selectedFeature. When features are set, the first index is automatically selected.
- Attribute
- selected-feature-index
showCollapseButton
- Type
- boolean
Indicates whether to show the collapse button in the component.
- Attribute
- show-collapse-button
- Default value
- false
spatialReference
- Type
- SpatialReference | null | undefined
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.
- Default value
- null
timeZone
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.30
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
updateLocationEnabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 5.0
Indicates whether to update the location when the selectedFeatureIndex changes.
- Attribute
- update-location-enabled
- Default value
- false
view
- Type
- MapViewOrSceneView | null | undefined
- Since
- ArcGIS Maps SDK for JavaScript 4.34
A reference to the MapView or SceneView.
The Features component requires a view to be set if:
- The features have a popupTemplate containing Arcade expressions in ExpressionInfo or ExpressionContent that may use geometry functions or reference the
$mapprofile variable (i.e. access data from layers within a map). Alternatively, set the map property. - Content is displayed from the popup template of an aggregate feature (i.e. a cluster or bin).
- Values from
dateandtimestamp-offsetfields should respect the view's time zone. Alternatively, set the timeZone property. - Using the fetchFeatures() method or the
fetchFeaturesoption in the open method. - Using the
Zoom todefault action. If theviewis not specified, set the includeDefaultActionsDisabled property totrueto remove this default action.
Methods
| Method | Signature |
|---|---|
clear(): Promise<void> | |
close(): Promise<void> | |
componentOnReady inherited | componentOnReady(): Promise<this> |
destroy(): Promise<void> | |
fetchFeatures(screenPoint?: ScreenPoint, options?: FetchFeaturesOptions): Promise<void> | |
next(): Promise<FeaturesViewModel> | |
previous(): Promise<FeaturesViewModel> | |
setFocus(): Promise<void> | |
triggerAction(action: ActionButton | ActionToggle): Promise<void> |
componentOnReady
- Signature
-
componentOnReady (): Promise<this>
Creates a promise that resolves once the component is fully loaded.
- Returns
- Promise<this>
Example
const arcgisFeatures = document.querySelector("arcgis-features");document.body.append(arcgisFeatures);await arcgisFeatures.componentOnReady();console.log("arcgis-features is ready to go!"); fetchFeatures
- Signature
-
fetchFeatures (screenPoint?: ScreenPoint, options?: FetchFeaturesOptions): Promise<void>
Use this method to return feature(s) at a given screen location. These features are fetched from all of the LayerViews in the view. In order to use this, a layer must already have an associated PopupTemplate and have its popupEnabled. This method allows a developer to control how the input location is handled. For example, you may want to fetch features on a click event or on a pointer-move event. This method automatically sets the location based on the input event's screen coordinates.
- See also
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| screenPoint | | | |
| options | | |
Example
const viewElement = document.querySelector("arcgis-map");// Get viewElement's click eventreactiveUtils.on(()=>viewElement, "arcgisViewClick", async (event)=>{ // Call fetchFeatures on the component and pass in the click event detail await component.fetchFeatures(event.detail);});// Watch for changes to the features property and open the component when features are available.reactiveUtils.watch( () => component.features, () => { component.open = component.features ? true : false; },); next
- Signature
-
next (): Promise<FeaturesViewModel>
Selects the feature at the next index in relation to the selectedFeature.
- See also
- Returns
- Promise<FeaturesViewModel>
previous
- Signature
-
previous (): Promise<FeaturesViewModel>
Selects the feature at the previous index in relation to the selectedFeature.
- See also
- Returns
- Promise<FeaturesViewModel>
triggerAction
- Signature
-
triggerAction (action: ActionButton | ActionToggle): Promise<void>
Triggers the @arcgisTriggerAction event and executes the action at the specified index in the actions array.
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| action | | |
Events
| Name | Type |
|---|---|
| CustomEvent<{ name: "active" | "collapsed" | "featureCount" | "featureMenuOpen" | "features" | "promises" | "selectedDrillInFeature" | "selectedFeature" | "selectedFeatureComponent" | "selectedFeatureIndex" | "state" | "open"; }> | |
arcgisClose
arcgisClose: CustomEvent<void> Emitted when the component's close button is clicked.
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "active" | "collapsed" | "featureCount" | "featureMenuOpen" | "features" | "promises" | "selectedDrillInFeature" | "selectedFeature" | "selectedFeatureComponent" | "selectedFeatureIndex" | "state" | "open"; }> Emitted when the value of a property is changed. Use this to listen to changes to properties.
arcgisReady
arcgisReady: CustomEvent<void> Emitted when the component associated with a map or scene view is ready to be interacted with.
arcgisTriggerAction
arcgisTriggerAction: CustomEvent<ActionEvent> Fires after the user clicks on an action in the component. This event may be used to define a custom function to execute when particular actions are clicked.
- See also
Example
// Fires each time an action is clickedreactiveUtils.on(()=> component, "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 }); }});