JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maps.googleapis.com/maps/api/js?v=3"></script>
<div id="map-canvas"></div>
CSS
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
JavaScript
// This example adds a red rectangle to a map.
function initialize() {
var map = new google.maps.Map(document.getElementById('map-canvas'), {
zoom: 20,
center: new google.maps.LatLng(40.626805, -89.539396),
mapTypeId: google.maps.MapTypeId.TERRAIN
});
var rectangle = new google.maps.Rectangle({
strokeColor: 'green',
strokeOpacity: 12,
strokeWeight: 12,
fillColor: 'green',
fillOpacity: 12,
map: map,
bounds: new google.maps.LatLngBounds(
new google.maps.LatLng(40.626805, -89.539396),
new google.maps.LatLng(40.626055, -89.538507))
});
}
google.maps.event.addDomListener(window, 'load', initialize);