import "@arcgis/map-components/components/arcgis-bookmarks";- Inheritance:
- ArcgisBookmarks→
PublicLitElement
- Since
- ArcGIS Maps SDK for JavaScript 4.28
The Bookmarks component allows end users to quickly navigate to a particular area of interest. It displays a list of bookmarks, which are typically defined inside the WebMap.
Each bookmark may contain the following properties: name, thumbnail, viewpoint (defines rotation, scale, and target geometry), and timeExtent.
When a bookmark with a timeExtent is selected, the arcgis-map.timeExtent of the Map will be set to the timeExtent of the selected bookmark.
To disable time capability in the Bookmarks component, set timeDisabled to true.
The Bookmarks component can be used to create, edit, reorder, and delete bookmarks.
To enable these features, set the following properties to true:
showAddBookmarkButton, showEditBookmarkButton, and dragEnabled.
Note: Bookmarks are supported in a 3D Scene only if they come from a WebMap or are provided manually from bookmarks. Presentation provides a similar experience for WebScenes.
- See also
Demo
Properties
| Property | Attribute | Type |
|---|---|---|
auto-destroy-disabled | ||
bookmarks | ||
closed reflected | closed | |
| ||
| ||
disabled | ||
drag-enabled | ||
filter-placeholder | ||
filter-text | ||
| ||
heading-level | ||
hide-thumbnail | ||
hide-time | ||
icon | ||
label | ||
| ||
reference-element | ||
show-add-bookmark-button | ||
show-close-button | ||
show-collapse-button | ||
show-edit-bookmark-button | ||
show-filter | ||
show-heading | ||
state readonly | | |
time-disabled | ||
|
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
bookmarks
- Type
- Collection<Bookmark>
A collection of Bookmarks. These are typically defined inside of a WebMap, but can also be defined manually, as shown in the code snippet below.
- Attribute
- bookmarks
Example
const bookmarksElement = document.querySelector("arcgis-bookmarks");// define bookmarks manuallybookmarksElement.bookmarks = [ new Bookmark({ name: "Angeles National Forest", viewpoint: { targetGeometry: { type: "extent", spatialReference: { wkid: 102100 }, xmin: -13139131.948889678, ymin: 4047767.23531948, xmax: -13092887.54677721, ymax: 4090610.189673263 } } }), new Bookmark({ name: "Crystal Lake", viewpoint: { targetGeometry: { type: "extent", spatialReference: { wkid: 102100 }, xmin: -13125852.551697943, ymin: 4066904.1101411926, xmax: -13114291.451169826, ymax: 4077614.8487296384 }, rotation: 90 } })]; closed
- Type
- boolean
Indicates whether a component is closed. When true, the component will be hidden.
- Attribute
- closed
- Default value
- false
defaultCreateOptions
- Type
- BookmarkOptions
Specifies how new bookmarks will be created if showAddBookmarkButton is set to true.
Can be used to enable or disable taking screenshots or capturing the bookmark's viewpoint based on the current
view when a bookmark is created.
Example
const bookmarksElement = document.querySelector("arcgis-bookmarks");bookmarksElement.showAddBookmarkButton = true;bookmarksElement.defaultCreateOptions = { // whenever a new bookmark is created, a 100x100 px // screenshot of the view will be taken and the rotation, scale, and extent // of the view will not be set as the viewpoint of the new bookmark takeScreenshot: true, captureViewpoint: false, captureTimeExtent: false, // the time extent will not be saved in the bookmark screenshotSettings: { width: 100, height: 100 }}; defaultEditOptions
- Type
- BookmarkOptions
Specifies how bookmarks will be edited, if showEditBookmarkButton is set to true.
Can be used to enable or disable taking screenshots or capturing the bookmark's viewpoint based on the current
view when a bookmark is edited.
disabled
- Type
- boolean
When true, the component is visually withdrawn and cannot receive user interaction.
- Attribute
- disabled
- Default value
- false
dragEnabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.29
Indicates if a Bookmark is able to be dragged in order to update its position in the list.
- Attribute
- drag-enabled
- Default value
- false
filterPlaceholder
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.29
Defines the text used as a placeholder when showFilter is set to true.
- Attribute
- filter-placeholder
- Default value
- ""
filterText
- Type
- string
- Since
- ArcGIS Maps SDK for JavaScript 4.29
Defines the text used to filter the bookmarks when showFilter is set to true.
- Attribute
- filter-text
- Default value
- ""
goToOverride
- Type
- GoToOverride | 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);}; headingLevel
- Type
- HeadingLevel
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Indicates the heading level to use for the message "No bookmarks" when no bookmarks
are available. By default, this message is rendered
as a level 2 heading (e.g. <h2>No bookmarks</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
// "No bookmarks" will render as an <h3>bookmarksElement.headingLevel = 3; hideThumbnail
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether the thumbnail associated with the bookmark is hidden.
- Attribute
- hide-thumbnail
- Default value
- false
hideTime
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether the time (h:m:s) displayed next to the date is hidden if the bookmark has a time extent defined.
- Attribute
- hide-time
- Default value
- false
icon
- Type
- IconName
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
- "bookmark"
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
showAddBookmarkButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether to display the button to add a new bookmark.
- Attribute
- show-add-bookmark-button
- Default value
- false
showCloseButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether to display the close button.
- Attribute
- show-close-button
- Default value
- false
showCollapseButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether to display the collapse button.
- Attribute
- show-collapse-button
- Default value
- false
showEditBookmarkButton
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether to display the button to edit a bookmark.
- Attribute
- show-edit-bookmark-button
- Default value
- false
showFilter
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether to display the bookmark filter.
- Attribute
- show-filter
- Default value
- false
showHeading
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.30
Indicates whether to display the heading.
- Attribute
- show-heading
- Default value
- false
state
- Type
- BookmarksState
The current state of the component.
- Default value
- "ready"
timeDisabled
- Type
- boolean
- Since
- ArcGIS Maps SDK for JavaScript 4.34
Indicates whether to disable the time capability of the Bookmarks component.
- Attribute
- time-disabled
- Default value
- false
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 arcgis-bookmarks 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> | |
goTo(bookmark: Bookmark): Promise<void> |
componentOnReady
- Signature
-
componentOnReady (): Promise<this>
Creates a promise that resolves once the component is fully loaded.
- Returns
- Promise<this>
Example
const arcgisBookmarks = document.querySelector("arcgis-bookmarks");document.body.append(arcgisBookmarks);await arcgisBookmarks.componentOnReady();console.log("arcgis-bookmarks is ready to go!");Events
| Name | Type |
|---|---|
| CustomEvent<{ name: "state"; }> | |
arcgisBookmarkEdit
arcgisBookmarkEdit: CustomEvent<BookmarkEditEvent> - Since
- ArcGIS Maps SDK for JavaScript 4.34
Fires when a Bookmark is edited.
Example
// once an edit has been made, enable the "Save Webmap" button// to allow the user to save their changesbookmarksElement.addEventListener("arcgisBookmarkEdit", (event) => { saveBtn.disabled = false;}); arcgisBookmarkSelect
arcgisBookmarkSelect: CustomEvent<BookmarkSelectEvent> - Since
- ArcGIS Maps SDK for JavaScript 4.34
Fires when a Bookmark is selected.
Example
<arcgis-expand expanded> <arcgis-bookmarks></arcgis-bookmarks></arcgis-expand>
<script> const bookmarksElement = document.querySelector("arcgis-bookmarks"); const expandElement = document.querySelector("arcgis-expand");
// collapses the associated Expand component // when a bookmark is selected bookmarksElement.addEventListener("arcgisBookmarkSelect", (event) => { expandElement.expanded = false; });</script> arcgisClose
arcgisClose: CustomEvent<void> Emitted when the component's close button is clicked.
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "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.