<div id="viewDiv">
</div>
html,
body,
#viewDiv {
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
}
require([
  "esri/WebMap",
  "esri/views/MapView",
  "esri/widgets/Legend"
], function(WebMap, MapView, Legend) {

  const map = new WebMap({
    portalItem: {
      id: "5c7bffd977d34ed0a4e8d60f9b6a5b91"
    }
  });
  const view = new MapView({
    container: "viewDiv",
    map: map
  });
  const legend = new Legend({view});
  
  view.ui.add(legend, "bottom-left");
});
Run Pen

External CSS

  1. https://js.arcgis.com/next/esri/themes/dark/main.css

External JavaScript

  1. https://js.arcgis.com/next