---
title: "size"
description: "Sets both the width and height of an element, in [Dp]."
type: "function"
---

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


<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


```kotlin
public fun GlanceModifier.size(size: Dp): GlanceModifier
```


Sets both the width and height of an element, in `Dp`.



<div class='sourceset sourceset-android'>Android</div>


```kotlin
public fun GlanceModifier.size(@DimenRes size: Int): GlanceModifier
```


Sets both width and height of an element from a resource.



<div class='sourceset sourceset-android'>Android</div>


```kotlin
public fun GlanceModifier.size(width: Dp, height: Dp): GlanceModifier
```


Sets both the width and height of an element, in `Dp`.



<div class='sourceset sourceset-android'>Android</div>


```kotlin
public fun GlanceModifier.size(@DimenRes width: Int, @DimenRes height: Int): GlanceModifier
```


Sets both the width and height of an element from resources.



