import "@arcgis/map-components/components/arcgis-feature";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.
Demo
Properties
| Property | Attribute | Type |
|---|---|---|
autoDestroyDisabled | auto-destroy-disabled | boolean |
chartAnimationDisabled | chart-animation-disabled | boolean |
defaultPopupTemplateEnabled | default-popup-template-enabled | boolean |
graphic | | Graphic |
headingreadonly | | string |
headingLevel | heading-level | 1 | 2 | 3 | 4 | 5 | 6 |
hideAttachmentsContent | hide-attachments-content | boolean |
hideContent | hide-content | boolean |
hideContentAttachmentsdeprecated | hide-content-attachments | boolean |
hideContentExpressiondeprecated | hide-content-expression | boolean |
hideContentFieldsdeprecated | hide-content-fields | boolean |
hideContentMediadeprecated | hide-content-media | boolean |
hideContentTextdeprecated | hide-content-text | boolean |
hideCustomContent | hide-custom-content | boolean |
hideExpressionContent | hide-expression-content | boolean |
hideFieldsContent | hide-fields-content | boolean |
hideHeading | hide-heading | boolean |
hideLastEditedInfo | hide-last-edited-info | boolean |
hideLastEditInfodeprecated | hide-last-edit-info | boolean |
hideMediaContent | hide-media-content | boolean |
hideTextContent | hide-text-content | boolean |
hideTitledeprecated | hide-title | boolean |
icon | icon | string |
isFeatureFromTablereadonly | | boolean |
label | label | string |
location | | Point |
map | | Map |
messageOverrides | | Record<string, unknown> |
positiondeprecatedreflected | position | "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing" |
referenceElement | reference-element | HTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | string |
showRelationshipContent | show-relationship-content | boolean |
showUtilityNetworkContent | show-utility-network-content | boolean |
spatialReference | | SpatialReference |
statereadonlyreflected | state | "disabled" | "error" | "loading" | "ready" |
timeZone | time-zone | string |
view | | MapView | SceneView |
viewModel | | FeatureViewModel |
autoDestroyDisabled
autoDestroyDisabled: booleanIf 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
chartAnimationDisabled: booleanDisables chart animation within the component.
- Attribute
- chart-animation-disabled
- Default value
- false
defaultPopupTemplateEnabled
defaultPopupTemplateEnabled: booleanEnables 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
graphic: GraphicThe Graphic used to represent the feature.
- See also
Example
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
heading: stringThe title for the feature. This can be disabled by setting the hideHeading property to true.
- See also
- Default value
- null
headingLevel
headingLevel: 1 | 2 | 3 | 4 | 5 | 6Indicates 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
// feature title will render as an <h3> feature.headingLevel = 3;
- Attribute
- heading-level
- Default value
- 2
hideAttachmentsContent
hideAttachmentsContent: booleanThis property provides the ability to hide or show attachments content within the component.
- Attribute
- hide-attachments-content
- Default value
- false
hideContent
hideContent: booleanThis property provides the ability to hide or show content within the component.
- Attribute
- hide-content
- Default value
- false
hideContentAttachments
hideContentAttachments: booleanhideAttachmentsContent instead.Indicates whether to hide all AttachmentsContent.
- Attribute
- hide-content-attachments
- Default value
- false
hideContentExpression
hideContentExpression: booleanhideExpressionContent instead.Indicates whether to hide all ExpressionContent.
- Attribute
- hide-content-expression
- Default value
- false
hideContentFields
hideContentFields: booleanhideFieldsContent instead.Indicates whether to hide all FieldsContent.
- Attribute
- hide-content-fields
- Default value
- false
hideContentMedia
hideContentMedia: booleanhideMediaContent instead.Indicates whether to hide all MediaContent.
- Attribute
- hide-content-media
- Default value
- false
hideContentText
hideContentText: booleanhideTextContent instead.Indicates whether to hide all TextContent.
- Attribute
- hide-content-text
- Default value
- false
hideCustomContent
hideCustomContent: booleanThis property provides the ability to hide or show custom content within the component.
- Attribute
- hide-custom-content
- Default value
- false
hideExpressionContent
hideExpressionContent: booleanThis property provides the ability to hide or show expression content within the component.
- Attribute
- hide-expression-content
- Default value
- false
hideFieldsContent
hideFieldsContent: booleanThis property provides the ability to hide or show fields content within the component.
- Attribute
- hide-fields-content
- Default value
- false
hideHeading
hideHeading: booleanThis property provides the ability to hide or show the component's heading.
- Attribute
- hide-heading
- Default value
- false
hideLastEditedInfo
hideLastEditedInfo: booleanThis property provides the ability to hide or show the last edited info within the component.
- Attribute
- hide-last-edited-info
- Default value
- false
hideLastEditInfo
hideLastEditInfo: booleanhideLastEditedInfo instead.Indicates whether to hide the title associated with the feature.
- Attribute
- hide-last-edit-info
- Default value
- false
hideMediaContent
hideMediaContent: booleanThis property provides the ability to hide or show media content within the component.
- Attribute
- hide-media-content
- Default value
- false
hideTextContent
hideTextContent: booleanThis property provides the ability to hide or show text content within the component.
- Attribute
- hide-text-content
- Default value
- false
hideTitle
hideTitle: booleanhideHeading instead.Indicates whether to hide the title associated with the feature.
- Attribute
- hide-title
- Default value
- false
icon
icon: stringIcon 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
isFeatureFromTable: booleanIndicates whether the current graphic resides in a non-spatial table.
- Default value
- false
location
location: PointThe Point representing the location of the map interaction used to trigger the opening of the component.
- Default value
- null
map
map: MapA 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.
Example
// The building footprints represent the buildings that intersect a clicked parcel let buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints"));
- Default value
- null
messageOverrides
messageOverrides: Record<string, unknown>Replace localized message strings with your own strings.
Note: Individual message keys may change between releases.
position
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"slot instead.- Attribute
- position
referenceElement
referenceElement: HTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | stringBy 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
showRelationshipContent
showRelationshipContent: booleanThis property provides the ability to hide or show relationship content within the component.
- Attribute
- show-relationship-content
- Default value
- false
showUtilityNetworkContent
showUtilityNetworkContent: booleanThis property provides the ability to hide or show utility network content within the component.
- Attribute
- show-utility-network-content
- Default value
- false
spatialReference
spatialReference: SpatialReferenceThe spatial reference used for Arcade operations. This property should be set if the component executes Arcade expressions that contain geometry functions.
- Default value
- null
state
state: "disabled" | "error" | "loading" | "ready"The current state of the component.
- Attribute
- state
- Default value
- "disabled"
timeZone
timeZone: stringDates 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
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
viewproperty 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 theviewproperty.
viewModel
viewModel: FeatureViewModelMethods
| Method | Signature |
|---|---|
componentOnReady | componentOnReady(): Promise<void> |
destroy | destroy(): Promise<void> |
nextMedia | nextMedia(contentElementIndex: number): Promise<void> |
previousMedia | previousMedia(contentElementIndex: number): Promise<void> |
setActiveMedia | setActiveMedia(contentElementIndex: number, mediaInfoIndex: number): Promise<void> |
updateGeometry | updateGeometry(): Promise<void> |
componentOnReady
componentOnReady(): Promise<void>Create a promise that resolves once component is fully loaded.
Example
const arcgisFeature = document.querySelector("arcgis-feature");
document.body.append(arcgisFeature);
await arcgisFeature.componentOnReady();
console.log("arcgis-feature is ready to go!");- Returns
- Promise<void>
nextMedia
nextMedia(contentElementIndex: number): Promise<void>Paginates to the next media info.
Parameters
| Parameter | Type | Optional? |
|---|---|---|
| contentElementIndex | number |
- Returns
- Promise<void>
previousMedia
previousMedia(contentElementIndex: number): Promise<void>Paginates to the previous media info.
Parameters
| Parameter | Type | Optional? |
|---|---|---|
| contentElementIndex | number |
- Returns
- Promise<void>
setActiveMedia
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
| Parameter | Type | Optional? |
|---|---|---|
| contentElementIndex | number | |
| mediaInfoIndex | number |
- Returns
- Promise<void>
updateGeometry
updateGeometry(): Promise<void>Updates the geometry of the graphic.
- Returns
- Promise<void>
Events
| Event | Type |
|---|---|
arcgisPropertyChange | CustomEvent<{ name: "state" | "flowItems"; }> |
arcgisReady | CustomEvent<void> |
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "state" | "flowItems"; }>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.