---
title: "<ScriptGoogleMapsRectangle> · Nuxt Scripts"
description: "Draw a reactive rectangular map overlay with resize, drag, and pointer events."
canonical_url: "https://scripts.nuxt.com/scripts/google-maps/api/rectangle"
meta:
  "og:description": "Draw a reactive rectangular map overlay with resize, drag, and pointer events."
  "og:image": "https://scripts.nuxt.com/_og/s/o_351d5203cb1c0f45.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "<ScriptGoogleMapsRectangle> · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_351d5203cb1c0f45.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Api**

# **\<ScriptGoogleMapsRectangle>**

[Copy for LLMs](https://scripts.nuxt.com/scripts/google-maps/api/rectangle.md)

Rectangular overlay on the map. Place it inside a [`**<ScriptGoogleMaps>**`](https://scripts.nuxt.com/scripts/google-maps/api/script-google-maps) component. Its options map to [`**google.maps.RectangleOptions**`](https://developers.google.com/maps/documentation/javascript/reference/polygon#RectangleOptions).

`**options**``Omit<google.maps.RectangleOptions, 'map'>`

Configuration options for the rectangle overlay.

## Usage

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsRectangle
      :options="{
        bounds: {
          north: -34.387,
          south: -34.407,
          east: 150.664,
          west: 150.624,
        },
        fillColor: '#00FF00',
        fillOpacity: 0.25,
        strokeWeight: 2,
      }"
    />
  </ScriptGoogleMaps>
</template>
```

### Editable & Draggable

Allow users to resize or reposition the rectangle interactively.

```vue
<template>
  <ScriptGoogleMaps api-key="your-api-key">
    <ScriptGoogleMapsRectangle
      :options="{
        bounds: {
          north: -34.387,
          south: -34.407,
          east: 150.664,
          west: 150.624,
        },
        editable: true,
        draggable: true,
        fillColor: '#4285F4',
        fillOpacity: 0.15,
      }"
      @bounds_changed="() => console.log('Bounds changed')"
      @click="(e) => console.log('Clicked at', e.latLng?.toJSON())"
    />
  </ScriptGoogleMaps>
</template>
```

The `**options**` prop is deeply reactive. Updating it calls `**rectangle.setOptions()**` under the hood, so you can dynamically change bounds, colors, or editability without remounting.

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/google-maps/2.api/8.rectangle.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/google-maps/api/rectangle.md)

[**\<ScriptGoogleMapsPolyline>** Draw reactive paths and routes on a Google map.](https://scripts.nuxt.com/scripts/google-maps/api/polyline) [**\<ScriptGoogleMapsGeoJson>** Load inline or remote GeoJSON into a reactive Google Maps Data layer.](https://scripts.nuxt.com/scripts/google-maps/api/geojson)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/rectangle#webpage","@type":"WebPage","description":"Draw a reactive rectangular map overlay with resize, drag, and pointer events.","name":"<ScriptGoogleMapsRectangle>","url":"https://scripts.nuxt.com/scripts/google-maps/api/rectangle","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/rectangle#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/google-maps/api/rectangle"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/google-maps/api/rectangle#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Google Maps","item":"https://scripts.nuxt.com/scripts/google-maps","position":3},{"@type":"ListItem","name":"API","item":"https://scripts.nuxt.com/scripts/google-maps/api","position":4},{"@type":"ListItem","name":"<ScriptGoogleMapsRectangle>","item":"https://scripts.nuxt.com/scripts/google-maps/api/rectangle","position":5}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
