Use Portal Basemaps

Explore in the sandboxView live

You can create Basemaps in your ArcGIS API for JavaScript applications using a Portal. In doing so, you can leverage your organizations default basemap or default vector basemap. You can define the portalUrl in the esriConfig and the BasemapGallery widget will use the configured basemaps in that portal.

1. Initialize a Portal Instance

// Default is portal for
const portal = new Portal();

2. Load Portal Resources

// If you define the Portal URL in esriConfig, the
// BasemapGallery widget can determine which basemaps
// to use.
esriConfig.portalUrl = "";
// Initialize a portal instance and load it
const portal = new Portal();
  .then(() => {
    // A portal can be configured to use Vector Basemaps
    // by default or not.
    const basemap = portal.useVectorBasemaps ?
          portal.defaultVectorBasemap : portal.defaultBasemap;
    const map = new Map({
      basemap: basemap
    const view = new MapView({
      container: "viewDiv",
      map: map,
      center: [-118.24, 34.073],
      scale: 10000
    // The BasemapGallery will use the basemaps
    // configured by the Portal URL defined in esriConfig.portalUrl
    const basemapGallery = new BasemapGallery({
      view: view
    const bgExpand = new Expand({
      view: view,
      content: basemapGallery
    view.ui.add(bgExpand, "top-right");
  .catch((error) => {

This allows you to use your organization settings to create consistent applications across your organization.