> For the complete documentation index, see [llms.txt](https://docs.overdare.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.overdare.com/development/api-reference/datatype/rect.md).

# Rect

## Overview

Rect is a data type used to express a rectangular area with two Vector2 values, representing a single rectangle through the top-left point Min and the bottom-right point Max.

## Constructors

### new

Creates and returns a new Rect whose Min and Max are both (0, 0).

#### Parameters

#### Return

| `Rect` | The created Rect. |
| ------ | ----------------- |

#### Code Samples

```lua
local NewRect = Rect.new()
```

### new

Creates and returns a new Rect using the two passed Vector2 values as the top-left and bottom-right points.

#### Parameters

| `Vector2` min | The top-left point.     |
| ------------- | ----------------------- |
| `Vector2` max | The bottom-right point. |

#### Return

| `Rect` | The created Rect. |
| ------ | ----------------- |

#### Code Samples

```lua
local Min = Vector2.new(10, 10)
local Max = Vector2.new(150, 150)
local NewRect = Rect.new(Min, Max)
```

### new

Creates and returns a new Rect based on the four passed coordinate values.

#### Parameters

| `number` minX | The X coordinate value of the top-left point.     |
| ------------- | ------------------------------------------------- |
| `number` minY | The Y coordinate value of the top-left point.     |
| `number` maxX | The X coordinate value of the bottom-right point. |
| `number` maxY | The Y coordinate value of the bottom-right point. |

#### Return

| `Rect` | The created Rect. |
| ------ | ----------------- |

#### Code Samples

```lua
local NewRect = Rect.new(10, 10, 150, 150)
```

## Properties

### Height

`number`

The height of the Rect in pixels, calculated from the difference between the Y coordinates of Max and Min. This is a read-only value, and attempting to modify it directly results in an error.

#### Code Samples

### Max

`Vector2`

The bottom-right point of the Rect. This is a read-only value, and attempting to modify it directly results in an error.

#### Code Samples

### Min

`Vector2`

The top-left point of the Rect. This is a read-only value, and attempting to modify it directly results in an error.

#### Code Samples

### Width

`number`

The width of the Rect in pixels, calculated from the difference between the X coordinates of Max and Min. This is a read-only value, and attempting to modify it directly results in an error.

#### Code Samples

## Methods

## Events

## See also

{% content-ref url="/pages/eHrtmMKd8kWc51tijR5V" %}
[ImageLabel](/development/api-reference/classes/imagelabel.md)
{% endcontent-ref %}

{% content-ref url="/pages/icUeAgDbD5Ij8LArLj7n" %}
[ImageButton](/development/api-reference/classes/imagebutton.md)
{% endcontent-ref %}
