This example demonstrates creating a map using HTML, with the `gmp-map` element.

Read the
[documentation](https://developers.google.com/maps/documentation/javascript/web-components/overview).
<iframe src="https://maps-docs-team.web.app/samples/web-components-map/dist/" allow="fullscreen; "></iframe>

### TypeScript

```typescript
// This example adds a map using web components.
```

### JavaScript

```javascript
// This example adds a map using web components.
```

### CSS

```css

```

### HTML

```html
<html>
    <head>
        <title>Add a Map using HTML</title>

        <link rel="stylesheet" type="text/css" href="./style.css" />
        <script type="module" src="./index.js"></script>
        <script
            async
            src="https://maps.googleapis.com/maps/api/js?loading=async&key=GOOGLE_MAPS_API_KEY&libraries=maps,marker"></script>
    </head>
    <body>
        <gmp-map
            center="37.4220656,-122.0840897"
            zoom="10"
            style="height: 500px"></gmp-map>
    </body>
</html>
```

### Try Sample

[JSFiddle.net](https://jsfiddle.net/gh/get/library/pure/googlemaps-samples/js-api-samples/tree/main/dist/samples/web-components-map/jsfiddle)

### Clone Sample


Git and Node.js are required to run this sample locally. Follow these [instructions](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
to install Node.js and NPM. You will also need a [Google Maps API key](https://developers.google.com/maps/documentation/javascript/get-api-key.md.txt).


The following commands clone the repository, install dependencies, and copy the environment file.

```javascript
  git clone https://github.com/googlemaps-samples/js-api-samples.git
  cd js-api-samples
  npm i
  cp .env.template .env
```


Once you copy the environment file, make sure to open the `.env` file and replace `<Insert your own development API key here>` with your actual API key before starting the sample.

```javascript
  cd samples/web-components-map
  npm start
```