Skip to content

Feature

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

The Feature component displays a graphic according to its PopupTemplate. This component is useful in instances where you want to display information about a feature but without the use of a Popup.

If wanting to show a feature's content with actions, related, or clustering, etc., then use the arcgis-features component.

When Arcade expressions that use $map or geometry functions are defined in any popup template content or as expression elements, the map and spatialReference properties need to be defined in the Feature component.

See also

Demo

Properties

PropertyAttributeType
autoDestroyDisabledauto-destroy-disabledboolean
chartAnimationDisabledchart-animation-disabledboolean
defaultPopupTemplateEnableddefault-popup-template-enabledboolean
graphicGraphic
heading
readonly
string
headingLevelheading-level1 | 2 | 3 | 4 | 5 | 6
hideAttachmentsContenthide-attachments-contentboolean
hideContenthide-contentboolean
hide-content-attachmentsboolean
hide-content-expressionboolean
hide-content-fieldsboolean
hide-content-mediaboolean
hideContentText
deprecated
hide-content-textboolean
hideCustomContenthide-custom-contentboolean
hideExpressionContenthide-expression-contentboolean
hideFieldsContenthide-fields-contentboolean
hideHeadinghide-headingboolean
hideLastEditedInfohide-last-edited-infoboolean
hide-last-edit-infoboolean
hideMediaContenthide-media-contentboolean
hideTextContenthide-text-contentboolean
hideTitle
deprecated
hide-titleboolean
iconiconstring
boolean
labellabelstring
locationPoint
mapMap
messageOverridesRecord<string, unknown>
position
deprecatedreflected
position"bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
referenceElementreference-elementHTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | string
showRelationshipContentshow-relationship-contentboolean
showUtilityNetworkContentshow-utility-network-contentboolean
spatialReferenceSpatialReference
state
readonlyreflected
state"disabled" | "error" | "loading" | "ready"
timeZonetime-zonestring
viewMapView | SceneView
viewModelFeatureViewModel

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

chartAnimationDisabled

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

Disables chart animation within the component.

Attribute
chart-animation-disabled
Default value
false

defaultPopupTemplateEnabled

Property
defaultPopupTemplateEnabled: boolean

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. (Supported for FeatureLayer, GeoJSONLayer, SceneLayer, CSVLayer, OGCFeatureLayer PointCloudLayer, StreamLayer, and ImageryLayer).

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 the 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

graphic

Property
graphic: Graphic

The Graphic used to represent the feature.

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
let graphic = new Graphic({
  geometry: view.center,
  attributes: {
    name: "Spruce",
    family: "Pinaceae",
    count: 126
  },
  symbol: new SimpleMarkerSymbol({
    style: "square",
    color: "blue",
    size: "8px"
  }),
  popupTemplate: {
    content: [
      {
        // Set popup template content
      }
    ]
  }
});
Default value
null

heading

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

The title for the feature. This can be disabled by setting the hideHeading property to true.

See also
Default value
null

headingLevel

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

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

See also
Example
Use dark colors for code blocksCopy
1

// feature title will render as an <h3> feature.headingLevel = 3;

Use dark colors for code blocksCopy
1
Attribute
heading-level
Default value
2

hideAttachmentsContent

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

This property provides the ability to hide or show attachments content within the component.

Attribute
hide-attachments-content
Default value
false

hideContent

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

This property provides the ability to hide or show content within the component.

Attribute
hide-content
Default value
false

hideContentAttachments

deprecatedProperty
hideContentAttachments: boolean
Deprecatedsince 4.34, use hideAttachmentsContent instead.

Indicates whether to hide all AttachmentsContent.

Attribute
hide-content-attachments
Default value
false

hideContentExpression

deprecatedProperty
hideContentExpression: boolean
Deprecatedsince 4.34, use hideExpressionContent instead.

Indicates whether to hide all ExpressionContent.

Attribute
hide-content-expression
Default value
false

hideContentFields

deprecatedProperty
hideContentFields: boolean
Deprecatedsince 4.34, use hideFieldsContent instead.

Indicates whether to hide all FieldsContent.

Attribute
hide-content-fields
Default value
false

hideContentMedia

deprecatedProperty
hideContentMedia: boolean
Deprecatedsince 4.34, use hideMediaContent instead.

Indicates whether to hide all MediaContent.

Attribute
hide-content-media
Default value
false

hideContentText

deprecatedProperty
hideContentText: boolean
Deprecatedsince 4.34, use hideTextContent instead.

Indicates whether to hide all TextContent.

Attribute
hide-content-text
Default value
false

hideCustomContent

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

This property provides the ability to hide or show custom content within the component.

Attribute
hide-custom-content
Default value
false

hideExpressionContent

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

This property provides the ability to hide or show expression content within the component.

Attribute
hide-expression-content
Default value
false

hideFieldsContent

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

This property provides the ability to hide or show fields content within the component.

Attribute
hide-fields-content
Default value
false

hideHeading

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

This property provides the ability to hide or show the component's heading.

Attribute
hide-heading
Default value
false

hideLastEditedInfo

Property
hideLastEditedInfo: boolean

This property provides the ability to hide or show the last edited info within the component.

Attribute
hide-last-edited-info
Default value
false

hideLastEditInfo

deprecatedProperty
hideLastEditInfo: boolean
Deprecatedsince 4.33, use hideLastEditedInfo instead.

Indicates whether to hide the title associated with the feature.

Attribute
hide-last-edit-info
Default value
false

hideMediaContent

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

This property provides the ability to hide or show media content within the component.

Attribute
hide-media-content
Default value
false

hideTextContent

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

This property provides the ability to hide or show text content within the component.

Attribute
hide-text-content
Default value
false

hideTitle

deprecatedProperty
hideTitle: boolean
Deprecatedsince 4.34, use hideHeading instead.

Indicates whether to hide the title associated with the feature.

Attribute
hide-title
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
Default value
"icon"

isFeatureFromTable

readonlyProperty
isFeatureFromTable: boolean
Since:ArcGIS Maps SDK for JavaScript 4.34Feature since 4.28, isFeatureFromTable added at 4.34.

Indicates whether the current graphic resides in a non-spatial table.

Default value
false

label

Property
label: string

The component's default label.

Attribute
label

location

Property
location: Point

The Point representing the location of the map interaction used to trigger the opening of the component.

Default value
null

map

Property
map: Map

A map is required when the input graphic 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
Example
Use dark colors for code blocksCopy
1

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

Use dark colors for code blocksCopy
1
Default value
null

messageOverrides

Property
messageOverrides: Record<string, unknown>
Since:ArcGIS Maps SDK for JavaScript 4.34Feature 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

deprecatedreflected
Property
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

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

showRelationshipContent

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

This property provides the ability to hide or show relationship content within the component.

Attribute
show-relationship-content
Default value
false

showUtilityNetworkContent

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

This property provides the ability to hide or show utility network content within the component.

Attribute
show-utility-network-content
Default value
false

spatialReference

Property
spatialReference: SpatialReference

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

See also
Default value
null

state

readonlyreflected
Property
state: "disabled" | "error" | "loading" | "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 MapView.timeZone. 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

The view associated with the component.

Note: The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this view property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the Feature component will be associated with a map or scene component rather than using the view property.

viewModel

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

Methods

MethodSignature
componentOnReadycomponentOnReady(): Promise<void>
destroydestroy(): Promise<void>
nextMedianextMedia(contentElementIndex: number): Promise<void>
previousMediapreviousMedia(contentElementIndex: number): Promise<void>
setActiveMediasetActiveMedia(contentElementIndex: number, mediaInfoIndex: number): Promise<void>
updateGeometryupdateGeometry(): 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 arcgisFeature = document.querySelector("arcgis-feature");
document.body.append(arcgisFeature);
await arcgisFeature.componentOnReady();
console.log("arcgis-feature is ready to go!");
Returns
Promise<void>

destroy

Method
destroy(): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

nextMedia

Method
nextMedia(contentElementIndex: number): Promise<void>

Paginates to the next media info.

Parameters
ParameterTypeOptional?
contentElementIndexnumber
Returns
Promise<void>

previousMedia

Method
previousMedia(contentElementIndex: number): Promise<void>

Paginates to the previous media info.

Parameters
ParameterTypeOptional?
contentElementIndexnumber
Returns
Promise<void>

setActiveMedia

Method
setActiveMedia(contentElementIndex: number, mediaInfoIndex: number): Promise<void>

Paginates to a specified media info object. For example, you may have media content which contains multiple mediaInfos. This method allows you to specify the index of the mediaInfos you wish to display.

Parameters
ParameterTypeOptional?
contentElementIndexnumber
mediaInfoIndexnumber
Returns
Promise<void>

updateGeometry

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

Updates the geometry of the graphic.

Returns
Promise<void>

Events

EventType
arcgisPropertyChangeCustomEvent<{ name: "state" | "flowItems"; }>
arcgisReadyCustomEvent<void>

arcgisPropertyChange

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

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

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