---
title: "RoundRect"
description: "Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii
along its horizontal axis and its vertical axis."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun RoundRect(
    left: Float,
    top: Float,
    right: Float,
    bottom: Float,
    radiusX: Float,
    radiusY: Float,
): RoundRect
```


Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radii
along its horizontal axis and its vertical axis.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun RoundRect(left: Float, top: Float, right: Float, bottom: Float, cornerRadius: CornerRadius) =
    RoundRect(left, top, right, bottom, cornerRadius.x, cornerRadius.y)
```


Construct a rounded rectangle from its left, top, right, and bottom edges, and the same radius in
each corner.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun RoundRect(rect: Rect, radiusX: Float, radiusY: Float): RoundRect
```


Construct a rounded rectangle from its bounding box and the same radii along its horizontal axis
and its vertical axis.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun RoundRect(rect: Rect, cornerRadius: CornerRadius): RoundRect
```


Construct a rounded rectangle from its bounding box and a radius that is the same in each corner.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun RoundRect(
    rect: Rect,
    topLeft: CornerRadius = CornerRadius.Zero,
    topRight: CornerRadius = CornerRadius.Zero,
    bottomRight: CornerRadius = CornerRadius.Zero,
    bottomLeft: CornerRadius = CornerRadius.Zero,
): RoundRect
```


Construct a rounded rectangle from its bounding box and topLeft, topRight, bottomRight, and
bottomLeft radii.

The corner radii default to `CornerRadius.Zero`, i.e. right-angled corners



