# Preview

Artifact: [androidx.glance:glance-preview](https://developer.android.com/jetpack/androidx/releases/glance) [View Source](https://cs.android.com/search?q=file:androidx/glance/preview/Preview.kt+class:androidx.glance.preview.Preview) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/glance#1.1.0)


```
@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.FUNCTION])
@ExperimentalGlancePreviewApi
@Repeatable
annotation Preview
```

<br />

*** ** * ** ***

The annotation to be used on a Glance composable for displaying visual previews in Android Studio.

The `https://developer.android.com/reference/kotlin/androidx/glance/preview/Preview#(kotlin.Int,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/glance/preview/Preview#(kotlin.Int,kotlin.Int)` parameters correspond to the size of the widget, i.e. the size available in the LocalSize composition local. When `https://developer.android.com/reference/kotlin/androidx/glance/preview/Preview#(kotlin.Int,kotlin.Int)` and `https://developer.android.com/reference/kotlin/androidx/glance/preview/Preview#(kotlin.Int,kotlin.Int)` aren't specified, the visual preview wraps its content. In this case, LocalSize should not be read within the composable.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/glance/preview/Preview#Preview(kotlin.Int,kotlin.Int)(widthDp: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, heightDp: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/glance/preview/Preview#heightDp()` height in DP that will be used when rendering the annotated Glance @`https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` and that will be set as the widget's LocalSize height. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/glance/preview/Preview#widthDp()` width in DP that will be used when rendering the annotated Glance @`https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` and that will be set as the widget's LocalSize width. |

## Public constructors

### Preview

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/glance#1.2.0)

```
Preview(widthDp: Int = -1, heightDp: Int = -1)
```

| Parameters |
|---|---|
| `widthDp: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = -1` | width in DP that will be used when rendering the annotated Glance @`https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` and that will be set as the widget's LocalSize width. |
| `heightDp: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = -1` | height in DP that will be used when rendering the annotated Glance @`https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` and that will be set as the widget's LocalSize height. |

## Public properties

### heightDp

```
val heightDp: Int
```

height in DP that will be used when rendering the annotated Glance @`https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` and that will be set as the widget's LocalSize height.

### widthDp

```
val widthDp: Int
```

width in DP that will be used when rendering the annotated Glance @`https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` and that will be set as the widget's LocalSize width.