# DpSize

Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/Dp.kt+class:androidx.compose.ui.unit.DpSize) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.1.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class DpSize
  ```

*** ** * ** ***

A two-dimensional Size using `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` for units

## Summary

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#Unspecified()` A size whose `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#width()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#height()` are unspecified. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#Zero()` A `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` with 0 DP `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#width()` and 0 DP `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#height()` values. | Cmn |

| ### Public functions |
|---|---|---|
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#component1()()` | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#component2()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#copy(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)` Returns a copy of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` instance optionally overriding the width or height parameter | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#div(kotlin.Float)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#div(kotlin.Int)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#minus(androidx.compose.ui.unit.DpSize)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize)` Subtract a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` from another one. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#plus(androidx.compose.ui.unit.DpSize)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize)` Add a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` to another one. | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#times(kotlin.Float)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` | Cmn |
| `operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#times(kotlin.Int)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#height()` The vertical aspect of the Size in `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#width()` The horizontal aspect of the Size in `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | Cmn |

| ### Extension functions |
|---|---|---|
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#(androidx.compose.ui.unit.DpSize).takeOrElse(kotlin.Function0)(block: () -> https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize)` If this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/package-summary#(androidx.compose.ui.geometry.Offset).isSpecified()` then this is returned, otherwise `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.DpSize).takeOrElse(kotlin.Function0)` is executed and its result is returned. | Cmn |

| ### Extension properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpOffset` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#(androidx.compose.ui.unit.DpSize).center()` Returns the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpOffset` of the center of the rect from the point of 0, 0 with this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#(androidx.compose.ui.unit.DpSize).isSpecified()` `false` when this is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#Unspecified()`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#(androidx.compose.ui.unit.DpSize).isUnspecified()` `true` when this is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#Unspecified()`. | Cmn |

## Public companion properties

### Unspecified

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

```
val Unspecified: DpSize
```

A size whose `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#width()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#height()` are unspecified. This is usually a replacement for `null` when a primitive value is desired. Access to `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#width()` or `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#height()` on an unspecified size is not allowed.

### Zero

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

```
val Zero: DpSize
```

A `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` with 0 DP `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#width()` and 0 DP `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#height()` values.

## Public functions

### component1

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

```
inline operator fun component1(): Dp
```

### component2

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

```
inline operator fun component2(): Dp
```

### copy

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

```
fun copy(width: Dp = this.width, height: Dp = this.height): DpSize
```

Returns a copy of this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` instance optionally overriding the width or height parameter

### div

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

```
operator fun div(other: Float): DpSize
```

### div

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

```
operator fun div(other: Int): DpSize
```

### minus

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

```
operator fun minus(other: DpSize): DpSize
```

Subtract a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` from another one.

### plus

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

```
operator fun plus(other: DpSize): DpSize
```

Add a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` to another one.

### times

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

```
operator fun times(other: Float): DpSize
```

### times

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

```
operator fun times(other: Int): DpSize
```

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### height

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

```
val height: Dp
```

The vertical aspect of the Size in `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`

### width

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

```
val width: Dp
```

The horizontal aspect of the Size in `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`

## Extension functions

### DpSize.takeOrElse

Cmn Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/Dp.kt+function:takeOrElse)

```
inline fun DpSize.takeOrElse(block: () -> DpSize): DpSize
```

If this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize` `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/package-summary#(androidx.compose.ui.geometry.Offset).isSpecified()` then this is returned, otherwise `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.DpSize).takeOrElse(kotlin.Function0)` is executed and its result is returned.

## Extension properties

### DpSize.center

Cmn Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/Dp.kt+symbol:center)

```
val DpSize.center: DpOffset
```

Returns the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpOffset` of the center of the rect from the point of 0, 0 with this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize`.

### DpSize.isSpecified

Cmn Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/Dp.kt+symbol:isSpecified)

```
val DpSize.isSpecified: Boolean
```

`false` when this is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#Unspecified()`.

### DpSize.isUnspecified

Cmn Artifact: [androidx.compose.ui:ui-unit](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/unit/Dp.kt+symbol:isUnspecified)

```
val DpSize.isUnspecified: Boolean
```

`true` when this is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/DpSize#Unspecified()`.