---
title: "maxSize"
description: "Constrains the maximum size (width and height) of the component."
type: "function"
lastmod: "2026-05-20T01:13:53.250789Z"
---
## API Reference

### maxSize

> Source set: Common

```kotlin
@ExperimentalFoundationStyleApi
fun MaxSizeScope.maxSize(size: DpSize)
```

Constrains the maximum size (width and height) of the component. The component's dimensions,
including padding, will be at most these values.

This property is *not* inherited

#### Parameters

| | |
| --- | --- |
| size | The maximum size ([DpSize](/jetpack-compose/androidx.compose.ui/ui-unit/functions/DpSize)). |

### maxSize

> Source set: Common

```kotlin
@ExperimentalFoundationStyleApi
fun MaxSizeScope.maxSize(width: Dp, height: Dp)
```

Constrains the maximum width and height of the component. The component's dimensions, including
padding, will be at most these values.

This property is *not* inherited

#### Parameters

| | |
| --- | --- |
| width | The maximum width. |
| height | The maximum height. |
