--- name: arcgis-embeddable-maps description: Embed lightweight, self-contained maps in web pages using the Embeddable Components package. Use for quick map embeds with minimal code and built-in UI controls. --- # ArcGIS Embeddable Maps Use this skill when embedding a lightweight, self-contained map into a web page with minimal code. The `@arcgis/embeddable-components` package provides the `arcgis-embedded-map` web component - a single element that bundles a WebMap viewer with optional built-in UI controls (legend, bookmarks, basemap gallery, fullscreen). This is a **new component package in 5.0** with no 4.x equivalent. > **When to use `arcgis-embedded-map` vs `arcgis-map`:** Use `arcgis-embedded-map` for simple, read-only map embeds (blogs, dashboards, reports) where you don't need custom widgets, editing, or programmatic map control. Use `arcgis-map` (see `arcgis-core-maps`) for full-featured applications. ## Import Patterns ### CDN (No Build Tools) ```html ``` ### Direct ESM Imports (Build Tools) ```javascript import "@arcgis/embeddable-components/components/arcgis-embedded-map"; ``` ## arcgis-embedded-map Component ### Properties | Property | Attribute | Type | Default | Description | | ----------- | ------------ | ------------------- | -------------------------- | ----------------------------------------------------- | | `itemId` | `item-id` | `string` | - | **Required.** Portal item ID of a WebMap | | `portalUrl` | `portal-url` | `string` | `"https://www.arcgis.com"` | Portal URL (ArcGIS Online or Enterprise) | | `apiKey` | `api-key` | `string` | - | API key for accessing the resource | | `center` | `center` | `number[] \| Point` | - | View center `[longitude, latitude]` | | `zoom` | `zoom` | `number` | - | Zoom level | | `scale` | `scale` | `string` | - | Map scale at center | | `extent` | - | `Extent` | - | Visible map extent (set via JS) | | `webMap` | - | `WebMap` | - | WebMap instance (set via JS, alternative to `itemId`) | | `theme` | `theme` | `string` | `"light"` | Component theme: `"light"` or `"dark"` | ### UI Control Properties | Property | Attribute | Type | Default | Description | | ----------------------- | ------------------------- | --------- | ------- | --------------------------------- | | `headingEnabled` | `heading-enabled` | `boolean` | `false` | Show the WebMap title | | `legendEnabled` | `legend-enabled` | `boolean` | `false` | Show the legend panel | | `bookmarksEnabled` | `bookmarks-enabled` | `boolean` | `false` | Show bookmarks panel | | `basemapGalleryEnabled` | `basemap-gallery-enabled` | `boolean` | `false` | Show basemap gallery panel | | `informationEnabled` | `information-enabled` | `boolean` | `false` | Show information panel | | `shareEnabled` | `share-enabled` | `boolean` | `false` | Show button to open in Map Viewer | | `fullscreenDisabled` | `fullscreen-disabled` | `boolean` | `false` | Disable the fullscreen button | | `scrollEnabled` | `scroll-enabled` | `boolean` | `true` | Enable mouse wheel scroll zooming | | `timeZoneLabelEnabled` | `time-zone-label-enabled` | `boolean` | `false` | Show time zone labels | ### Methods | Method | Returns | Description | | -------------------- | --------------- | ------------------------------------------- | | `componentOnReady()` | `Promise` | Resolves when the component is fully loaded | ## Basic Usage ### Minimal Embed ```html ``` ### Embed with All UI Controls ```html ``` ### Dark Theme ```html ``` ### Custom Center and Zoom ```html ``` ### Disable Scroll Zoom (For Inline Content) ```html ``` ### With API Key ```html ``` ### Enterprise Portal ```html ``` ## CDN Full Example ```html Embedded Map

City Demographics

Explore population data across the region.

Data source: US Census Bureau

``` ## Programmatic Configuration ### Setting Extent via JavaScript ```javascript const embeddedMap = document.querySelector("arcgis-embedded-map"); await embeddedMap.componentOnReady(); embeddedMap.extent = { xmin: -118.5, ymin: 33.8, xmax: -117.9, ymax: 34.3, spatialReference: { wkid: 4326 }, }; ``` ### Using a WebMap Instance ```javascript const WebMap = await $arcgis.import("@arcgis/core/WebMap.js"); const webMap = new WebMap({ portalItem: { id: "f2e9b762544945f390ca4ac3671cfa72" }, }); const embeddedMap = document.querySelector("arcgis-embedded-map"); embeddedMap.webMap = webMap; ``` ## Theming with CSS Variables The component supports Calcite Design System CSS variables: ```css arcgis-embedded-map { --calcite-color-brand: #007ac2; --calcite-color-foreground-1: #ffffff; --calcite-color-text-1: #151515; --calcite-color-border-1: #cacaca; } ``` ## Common Pitfalls 1. **Missing `item-id`**: The component requires a WebMap portal item ID. ```html ``` ```html ``` **Impact:** The component renders an empty container with no map. 2. **Missing embeddable-components script**: The package must be loaded separately. ```html ``` ```html ``` **Impact:** The element is unrecognized and renders as empty. 3. **No explicit size**: The embedded map needs width and height to render visibly. ```html ``` ```html ``` **Impact:** The map renders with zero height and is invisible on the page. 4. **Using `arcgis-embedded-map` for interactive apps**: This component is designed for simple embeds. It does not support custom widgets, editing, layer manipulation, or programmatic view control. Use `arcgis-map` from `@arcgis/map-components` for full applications. **Impact:** Attempting to add widgets or edit features fails silently. 5. **Scroll zoom in long pages**: When the embedded map is inline with scrollable content, scroll zoom can trap users. Disable it for better UX. ```html ``` **Impact:** Users get stuck zooming the map when they want to scroll the page. ## Reference Samples - Search for embedded map samples demonstrating lightweight WebMap embedding. ## Related Skills - See `arcgis-core-maps` for full-featured map applications using `arcgis-map` and `arcgis-scene`. - See `arcgis-starter-app` for project scaffolding and CDN setup. - See `arcgis-authentication` for API key and portal authentication.