import "@arcgis/map-components/components/arcgis-feature";- Inheritance:
- ArcgisFeature→
PublicLitElement
- 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.
Demo
Properties
| Property | Attribute | Type |
|---|---|---|
auto-destroy-disabled | ||
chart-animation-disabled | ||
default-popup-template-enabled | ||
| ||
heading readonly | | |
heading-level | ||
hide-attachments-content | ||
hide-content | ||
hide-custom-content | ||
hide-expression-content | ||
hide-fields-content | ||
hide-heading | ||
hide-last-edited-info | ||
hide-media-content | ||
hide-text-content | ||
icon | ||
isFeatureFromTable readonly | | |
label | ||
| ||
| ||
| ||
reference-element | ||
show-relationship-content | ||
show-utility-network-content | ||
| ||
state readonly | | |
time-zone | ||
| ||
|
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
defaultPopupTemplateEnabled
- Type
- 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
The Graphic used to represent the feature.
- See also
- Default value
- null
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 } ] }}); heading
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.34
The title for the feature. This can be disabled by setting the hideHeading property to true.
- See also
- Default value
- null
headingLevel
- Type
- HeadingLevel
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
- Attribute
- heading-level
- Default value
- 2
Example
// feature title will render as an
feature.headingLevel = 3;
hideAttachmentsContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
This property provides the ability to hide or show attachments content within the component.
- Attribute
- hide-attachments-content
- Default value
- false
hideContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
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 4.34
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 4.34
This property provides the ability to hide or show expression content within the component.
- Attribute
- hide-expression-content
- Default value
- false
hideFieldsContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
This property provides the ability to hide or show fields content within the component.
- Attribute
- hide-fields-content
- Default value
- false
hideLastEditedInfo
- Type
- 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
hideMediaContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
This property provides the ability to hide or show media content within the component.
- Attribute
- hide-media-content
- Default value
- false
hideTextContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
This property provides the ability to hide or show text content within the component.
- Attribute
- hide-text-content
- Default value
- false
isFeatureFromTable
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Indicates whether the current graphic resides in a non-spatial table.
- Default value
- false
location
- Since
- ArcGIS Maps SDK for JavaScript 4.29
The Point representing the location of the map interaction used to trigger the opening of the component.
Example
view.on("click", (event) => { const { mapPoint } = event; feature.viewModel.location = mapPoint;}); 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.
- Default value
- null
Example
// The building footprints represent the buildings that intersect a clicked parcel let buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints"));
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
showRelationshipContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
This property provides the ability to hide or show relationship content within the component.
- Attribute
- show-relationship-content
- Default value
- false
showUtilityNetworkContent
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 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
- Type
- SpatialReference | null | undefined
The spatial reference used for Arcade operations. This property should be set if the component executes Arcade expressions that contain geometry functions.
- Default value
- null
timeZone
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.29
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
- Type
- MapViewOrSceneView | null | undefined
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 arcgis-feature component will be associated with a map or scene component rather than using theviewproperty.
Methods
| Method | Signature |
|---|---|
componentOnReady inherited | componentOnReady(): Promise<this> |
destroy(): Promise<void> | |
nextMedia(contentElementIndex: number): Promise<void> | |
previousMedia(contentElementIndex: number): Promise<void> | |
setActiveMedia(contentElementIndex: number, mediaInfoIndex: number): Promise<void> | |
updateGeometry(): Promise<void> |
componentOnReady
- Signature
-
componentOnReady (): Promise<this>
Creates a promise that resolves once the component is fully loaded.
- Returns
- Promise<this>
Example
const arcgisFeature = document.querySelector("arcgis-feature");document.body.append(arcgisFeature);await arcgisFeature.componentOnReady();console.log("arcgis-feature is ready to go!"); setActiveMedia
- Signature
-
setActiveMedia (contentElementIndex: number, mediaInfoIndex: number): Promise<void>
Events
| Name | Type |
|---|---|
| CustomEvent<{ name: "flowItems" | "state"; }> | |
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "flowItems" | "state"; }> 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.