# SizeScope

Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+class:androidx.compose.foundation.style.SizeScope) Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0) Common/All
- Cmn

  ```
  @ExperimentalFoundationStyleApi
  interface SizeScope
  ```
Known direct subclasses [LayoutStyleScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/LayoutStyleScope)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/LayoutStyleScope` | An interface that introduces the layout properties to a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` receiver scope. |

Known indirect subclasses [StyleScope](https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` | A `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` is the receiver scope of a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` lambda. |

*** ** * ** ***

An interface that introduces size properties to a `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/Style` receiver scope interface.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/StyleScope` |   |

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#height(kotlin.Float)(fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the height of the component to a fraction of the parent's available height. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#height(androidx.compose.ui.unit.Dp)(value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Sets the preferred height of the component. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#width(kotlin.Float)(fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the width of the component to a fraction of the parent's available width. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#width(androidx.compose.ui.unit.Dp)(value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Sets the preferred width of the component. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#(androidx.compose.foundation.style.SizeScope).fillHeight()()` Sets the height of the component to fill the parent's available height (equivalent to `height(1.0f)`). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#(androidx.compose.foundation.style.SizeScope).fillSize()()` Sets the width and height of the component to fill the parent's available space (equivalent to `width(1.0f)` and `height(1.0f)`). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#(androidx.compose.foundation.style.SizeScope).fillWidth()()` Sets the width of the component to fill the parent's available width (equivalent to `width(1.0f)`). | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#(androidx.compose.foundation.style.SizeScope).size(androidx.compose.ui.unit.Dp)(value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Sets the preferred width and height of the component to the same value. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#(androidx.compose.foundation.style.SizeScope).size(androidx.compose.ui.unit.DpSize)(value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize)` Sets the preferred width and height of the component using a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` object. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/ExperimentalFoundationStyleApi https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope.https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#(androidx.compose.foundation.style.SizeScope).size(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)(width: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, height: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Sets the preferred width and height of the component. | Cmn |

## Public functions

### height

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
fun height(fraction: @FloatRange(from = 0.0, to = 1.0) Float): Unit
```

Sets the height of the component to a fraction of the parent's available height. The specified height includes any padding.

This property is *not* inherited

| Parameters |
|---|---|
| `fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The fraction of the available height (e.g., 0.5f for 50%). |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillHeight()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxHeight.modifier#(androidx.compose.ui.Modifier).fillMaxHeight(kotlin.Float)` |   |

### height

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
fun height(value: Dp): Unit
```

Sets the preferred height of the component. The actual size will also depend on the parent's constraints and other modifiers. The specified height includes both `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.ContentPaddingScope).contentPadding(androidx.compose.ui.unit.Dp)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.ExternalPaddingScope).externalPadding(androidx.compose.ui.unit.Dp)`.

This property is *not* inherited

| Parameters |
|---|---|
| `value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred height in Dp. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#width(androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).size(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillHeight()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/MinSizeScope#minWidth(androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/MaxSizeScope#maxWidth(androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/height.modifier#(androidx.compose.ui.Modifier).height(androidx.compose.foundation.layout.IntrinsicSize)` |   |

### width

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
fun width(fraction: @FloatRange(from = 0.0, to = 1.0) Float): Unit
```

Sets the width of the component to a fraction of the parent's available width. The specified width includes any padding.

This property is *not* inherited

| Parameters |
|---|---|
| `fraction: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | The fraction of the available width (e.g., 0.5f for 50%). |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillWidth()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxWidth.modifier#(androidx.compose.ui.Modifier).fillMaxWidth(kotlin.Float)` |   |

### width

Cmn Added in [1.12.0](https://developer.android.com/jetpack/androidx/releases/compose-foundation#1.12.0)

```
fun width(value: Dp): Unit
```

Sets the preferred width of the component. The actual size will also depend on the parent's constraints and other modifiers. The specified width includes both `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.ContentPaddingScope).contentPadding(androidx.compose.ui.unit.Dp)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.ExternalPaddingScope).externalPadding(androidx.compose.ui.unit.Dp)`.

This property is *not* inherited

| Parameters |
|---|---|
| `value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred width in Dp. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#height(androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).size(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/SizeScope#width(androidx.compose.ui.unit.Dp)` | (Float) |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillWidth()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/MinSizeScope#minWidth(androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/MaxSizeScope#maxWidth(androidx.compose.ui.unit.Dp)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/width.modifier#(androidx.compose.ui.Modifier).width(androidx.compose.foundation.layout.IntrinsicSize)` |   |

## Extension functions

### SizeScope.fillHeight

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+function:fillHeight)

```
@ExperimentalFoundationStyleApi
fun SizeScope.fillHeight(): Unit
```

Sets the height of the component to fill the parent's available height (equivalent to `height(1.0f)`). The specified height includes any padding.

This property is *not* inherited

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillWidth()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillSize()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxHeight.modifier#(androidx.compose.ui.Modifier).fillMaxHeight(kotlin.Float)` |   |

### SizeScope.fillSize

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+function:fillSize)

```
@ExperimentalFoundationStyleApi
fun SizeScope.fillSize(): Unit
```

Sets the width and height of the component to fill the parent's available space (equivalent to `width(1.0f)` and `height(1.0f)`). The specified size includes any padding.

This property is *not* inherited

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillWidth()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillHeight()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxSize.modifier#(androidx.compose.ui.Modifier).fillMaxSize(kotlin.Float)` |   |

### SizeScope.fillWidth

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+function:fillWidth)

```
@ExperimentalFoundationStyleApi
fun SizeScope.fillWidth(): Unit
```

Sets the width of the component to fill the parent's available width (equivalent to `width(1.0f)`). The specified width includes any padding.

This property is *not* inherited

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillHeight()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.SizeScope).fillSize()` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/fillMaxWidth.modifier#(androidx.compose.ui.Modifier).fillMaxWidth(kotlin.Float)` |   |

### SizeScope.size

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+function:size)

```
@ExperimentalFoundationStyleApi
fun SizeScope.size(value: Dp): Unit
```

Sets the preferred width and height of the component to the same value. The actual size will also depend on the parent's constraints and other modifiers. The specified size includes any padding.

This property is *not* inherited

| Parameters |
|---|---|
| `value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred width and height in Dp. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/size.modifier#(androidx.compose.ui.Modifier).size(androidx.compose.ui.unit.Dp)` |   |

### SizeScope.size

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+function:size)

```
@ExperimentalFoundationStyleApi
fun SizeScope.size(value: DpSize): Unit
```

Sets the preferred width and height of the component using a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` object. The actual size will also depend on the parent's constraints and other modifiers. The specified size includes any padding.

This property is *not* inherited

| Parameters |
|---|---|
| `value: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | The preferred size. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/size.modifier#(androidx.compose.ui.Modifier).size(androidx.compose.ui.unit.Dp)` |   |

### SizeScope.size

Cmn Artifact: [androidx.compose.foundation:foundation](https://developer.android.com/jetpack/androidx/releases/compose-foundation) [View Source](https://cs.android.com/search?q=file:androidx/compose/foundation/style/StyleScope.kt+function:size)

```
@ExperimentalFoundationStyleApi
fun SizeScope.size(width: Dp, height: Dp): Unit
```

Sets the preferred width and height of the component. The actual size will also depend on the parent's constraints and other modifiers. The specified dimensions includes both `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.ContentPaddingScope).contentPadding(androidx.compose.ui.unit.Dp)` and `https://developer.android.com/reference/kotlin/androidx/compose/foundation/style/package-summary#(androidx.compose.foundation.style.ExternalPaddingScope).externalPadding(androidx.compose.ui.unit.Dp)`.

This property is *not* inherited

| Parameters |
|---|---|
| `width: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred width in Dp. |
| `height: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The preferred height in Dp. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/size.modifier#(androidx.compose.ui.Modifier).size(androidx.compose.ui.unit.Dp)` |   |