# Dp

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.Dp) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Common/AllAndroid/JVM
- Cmn

  ```
  value class Dp : Comparable<Dp>
  ```

*** ** * ** ***

Dimension value representing device-independent pixels (dp). Component APIs specify their dimensions such as line thickness in DP with Dp objects. Hairline (1 pixel) thickness may be specified with `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Hairline()`, a dimension that take up no space. Dp are normally defined using `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(kotlin.Int).dp()`, which can be applied to `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html`, and `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html`.

```kotlin
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp

Box(
    Modifier.padding(
        10.dp, // Int
        10f.dp, // Float
        20.0.dp, // Double
        10.dp,
    )
)
```

Drawing and Layout are done in pixels. To retrieve the pixel size of a Dp, use `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Density#(androidx.compose.ui.unit.Dp).toPx()`:

```kotlin
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.drawscope.Stroke
import androidx.compose.ui.graphics.drawscope.inset
import androidx.compose.ui.unit.dp

val lineThickness = 6.dp
Canvas(Modifier.fillMaxSize()) {
    val lineThicknessPx = lineThickness.toPx()
    inset(lineThicknessPx / 2) { drawRect(Color.Red, style = Stroke(lineThicknessPx)) }
}
```

## Summary

| ### Nested types |
|---|
| `object https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.Companion` |

| ### Public companion properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Hairline()` A dimension used to represent a hairline drawing element. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Infinity()` Infinite dp dimension. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Unspecified()` Constant that means unspecified Dp. | Cmn |

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Dp(kotlin.Float)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#compareTo(androidx.compose.ui.unit.Dp)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Support comparing Dimensions with comparison operators. | Cmn |
| `inline operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#div(androidx.compose.ui.unit.Dp)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Divide by another Dp to get a scalar. | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#div(kotlin.Float)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Divide a Dp by a scalar. | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#div(kotlin.Int)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#minus(androidx.compose.ui.unit.Dp)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Subtract a Dp from another one. | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#plus(androidx.compose.ui.unit.Dp)(other: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Add two `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`s together. | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#times(kotlin.Float)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Multiply a Dp by a scalar. | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#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/Dp#toString()()` | Cmn |
| `inline operator https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#unaryMinus()()` This is the same as multiplying the Dp by -1.0. | Cmn |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#value()` | Cmn |

| ### Extension functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).assertIsEqualTo(androidx.compose.ui.unit.Dp,kotlin.String,androidx.compose.ui.unit.Dp)(expected: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, subject: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, tolerance: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Asserts that this value is equal to the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.unit.Dp).assertIsEqualTo(androidx.compose.ui.unit.Dp,kotlin.String,androidx.compose.ui.unit.Dp)` value. | Cmn |
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).coerceAtLeast(androidx.compose.ui.unit.Dp)(minimumValue: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Ensures that this value is not less than the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtLeast(androidx.compose.ui.unit.Dp)`. | Cmn |
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).coerceAtMost(androidx.compose.ui.unit.Dp)(maximumValue: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Ensures that this value is not greater than the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtMost(androidx.compose.ui.unit.Dp)`. | Cmn |
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)(minimumValue: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, maximumValue: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` Ensures that this value lies in the specified range `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)`.. | Cmn |
| `inline https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).takeOrElse(kotlin.Function0)(block: () -> https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp)` If this `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.Dp).takeOrElse(kotlin.Function0)` is executed and its result is returned. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteFloat` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).toPx(androidx.compose.remote.creation.compose.capture.RemoteDensity)(density: https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/capture/RemoteDensity)` Converts a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to pixels using the provided `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/capture/RemoteDensity`. | android |
| `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteDp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).asRdp()()` Extension function to convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to a `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteDp`. | android |
| `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteTextUnit` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).toRsp()()` Extension function to convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to a `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteTextUnit` in Sp. | android |

| ### Extension properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).isFinite()` Return `true` when it is finite or `false` when it is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Infinity()` | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).isSpecified()` `false` when this is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Unspecified()`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).isUnspecified()` `true` when this is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Unspecified()`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteDp` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp.https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#(androidx.compose.ui.unit.Dp).rdp()` Extension property to convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to a `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteDp`. | android |

## Public companion properties

### Hairline

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

```
val Hairline: Dp
```

A dimension used to represent a hairline drawing element. Hairline elements take up no space, but will draw a single pixel, independent of the device's resolution and density.

### Infinity

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

```
val Infinity: Dp
```

Infinite dp dimension.

### Unspecified

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

```
val Unspecified: Dp
```

Constant that means unspecified Dp. Instead of comparing a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` value to this constant, consider using `https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/package-summary#(androidx.compose.ui.geometry.Offset).isSpecified()` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).isUnspecified()` instead.

## Public constructors

### Dp

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

```
Dp(value: Float)
```

## Public functions

### compareTo

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

```
open operator fun compareTo(other: Dp): Int
```

Support comparing Dimensions with comparison operators.

### div

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

```
inline operator fun div(other: Dp): Float
```

Divide by another Dp to get a scalar.

### div

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

```
inline operator fun div(other: Float): Dp
```

Divide a Dp by a scalar.

### div

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

```
inline operator fun div(other: Int): Dp
```

### minus

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

```
inline operator fun minus(other: Dp): Dp
```

Subtract a Dp from another one.

### plus

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

```
inline operator fun plus(other: Dp): Dp
```

Add two `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp`s together.

### times

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

```
inline operator fun times(other: Float): Dp
```

Multiply a Dp by a scalar.

### times

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

```
inline operator fun times(other: Int): Dp
```

### toString

Cmn

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

### unaryMinus

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

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

This is the same as multiplying the Dp by -1.0.

## Public properties

### value

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

```
val value: Float
```

## Extension functions

### Dp.assertIsEqualTo

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

```
fun Dp.assertIsEqualTo(expected: Dp, subject: String, tolerance: Dp = Dp(.5f)): Unit
```

Asserts that this value is equal to the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.unit.Dp).assertIsEqualTo(androidx.compose.ui.unit.Dp,kotlin.String,androidx.compose.ui.unit.Dp)` value.

Performs the comparison with the given `https://developer.android.com/reference/kotlin/androidx/compose/ui/test/package-summary#(androidx.compose.ui.unit.Dp).assertIsEqualTo(androidx.compose.ui.unit.Dp,kotlin.String,androidx.compose.ui.unit.Dp)` or the default one if none is provided. It is recommended to use tolerance when comparing positions and size coming from the framework as there can be rounding operation performed by individual layouts so the values can be slightly off from the expected ones.

| Parameters |
|---|---|
| `expected: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | The expected value to which this one should be equal to. |
| `subject: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Used in the error message to identify which item this assertion failed on. |
| `tolerance: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = Dp(.5f)` | The tolerance within which the values should be treated as equal. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-assertion-error/index.html` | if comparison fails. |

### Dp.coerceAtLeast

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:coerceAtLeast)

```
inline fun Dp.coerceAtLeast(minimumValue: Dp): Dp
```

Ensures that this value is not less than the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtLeast(androidx.compose.ui.unit.Dp)`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | this value if it's greater than or equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtLeast(androidx.compose.ui.unit.Dp)` or the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtLeast(androidx.compose.ui.unit.Dp)` otherwise. |

### Dp.coerceAtMost

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:coerceAtMost)

```
inline fun Dp.coerceAtMost(maximumValue: Dp): Dp
```

Ensures that this value is not greater than the specified `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtMost(androidx.compose.ui.unit.Dp)`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | this value if it's less than or equal to the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtMost(androidx.compose.ui.unit.Dp)` or the `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceAtMost(androidx.compose.ui.unit.Dp)` otherwise. |

### Dp.coerceIn

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:coerceIn)

```
inline fun Dp.coerceIn(minimumValue: Dp, maximumValue: Dp): Dp
```

Ensures that this value lies in the specified range `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)`..`https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` | this value if it's in the range, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)` if this value is less than `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)`, or `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)` if this value is greater than `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary#(androidx.compose.ui.unit.Dp).coerceIn(androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp)`. |

### Dp.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 Dp.takeOrElse(block: () -> Dp): Dp
```

If this `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.Dp).takeOrElse(kotlin.Function0)` is executed and its result is returned.

### Dp.toPx

android Artifact: [androidx.compose.remote:remote-creation-compose](https://developer.android.com/jetpack/androidx/releases/compose-remote) [View Source](https://cs.android.com/search?q=file:androidx/compose/remote/creation/compose/capture/RemoteDensityCompose.kt+function:toPx)

```
fun Dp.toPx(density: RemoteDensity): RemoteFloat
```

Converts a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to pixels using the provided `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/capture/RemoteDensity`.

| Parameters |
|---|---|
| `density: https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/capture/RemoteDensity` | The `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/capture/RemoteDensity` used to convert this `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to pixels. |

### Dp.asRdp

android Artifact: [androidx.compose.remote:remote-creation-compose](https://developer.android.com/jetpack/androidx/releases/compose-remote) [View Source](https://cs.android.com/search?q=file:androidx/compose/remote/creation/compose/state/RemoteDpCompose.kt+function:asRdp)

```
fun Dp.asRdp(): RemoteDp
```

Extension function to convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to a `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteDp`.

### Dp.toRsp

android Artifact: [androidx.compose.remote:remote-creation-compose](https://developer.android.com/jetpack/androidx/releases/compose-remote) [View Source](https://cs.android.com/search?q=file:androidx/compose/remote/creation/compose/state/RemoteTextUnit.kt+function:toRsp)

```
fun Dp.toRsp(): RemoteTextUnit
```

Extension function to convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to a `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteTextUnit` in Sp.

## Extension properties

### Dp.isFinite

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:isFinite)

```
val Dp.isFinite: Boolean
```

Return `true` when it is finite or `false` when it is `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp#Infinity()`

### Dp.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 Dp.isSpecified: Boolean
```

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

### Dp.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 Dp.isUnspecified: Boolean
```

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

### Dp.rdp

android Artifact: [androidx.compose.remote:remote-creation-compose](https://developer.android.com/jetpack/androidx/releases/compose-remote) [View Source](https://cs.android.com/search?q=file:androidx/compose/remote/creation/compose/state/RemoteDpCompose.kt+symbol:rdp)

```
val Dp.rdp: RemoteDp
```

Extension property to convert a `https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp` to a `https://developer.android.com/reference/kotlin/androidx/compose/remote/creation/compose/state/RemoteDp`.