# A2uiImageRenderer

Artifact: [androidx.compose.material3:material3-a2ui](https://developer.android.com/jetpack/androidx/releases/compose-material3) [View Source](https://cs.android.com/search?q=file:androidx/compose/material3/a2ui/catalog/MaterialA2uiBasicCatalogV1Image.kt+class:androidx.compose.material3.a2ui.catalog.A2uiImageRenderer) Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/compose-material3#1.0.0-alpha02)


```
fun interface A2uiImageRenderer
```

<br />

*** ** * ** ***

An abstraction of an asynchronous image loader which should be implemented using the application's image loading library (such as Coil or Glide), used for rendering an image for `https://developer.android.com/reference/kotlin/androidx/a2ui/compose/ui/catalog/A2uiBasicCatalogV1.Image`.

Example using Coil's `AsyncImage`:

```kotlin
val imageRenderer =
    A2uiImageRenderer { url, contentDescription, contentScale, modifier, onError ->
        AsyncImage(
            model = url,
            contentDescription = contentDescription,
            contentScale = contentScale,
            modifier = modifier,
            onError = { state -> onError(state.result.throwable) },
        )
    }
```

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable https://developer.android.com/reference/kotlin/androidx/compose/material3/a2ui/catalog/A2uiImageRenderer#Image(kotlin.String,kotlin.String,androidx.compose.ui.layout.ContentScale,androidx.compose.ui.Modifier,kotlin.Function1)( url: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, contentDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?, contentScale: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, onError: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Displays an image from a URL. |

## Public functions

### Image

```
@Composable
fun Image(
    url: String,
    contentDescription: String?,
    contentScale: ContentScale,
    modifier: Modifier,
    onError: (Throwable?) -> Unit
): Unit
```

Displays an image from a URL.

| Parameters |
|---|---|
| `url: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The URL of the image to load. |
| `contentDescription: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | Accessibility text for the image. |
| `contentScale: https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/ContentScale` | How the image should be scaled to fit its bounds. |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | The modifier to be applied to the layout. |
| `onError: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html?) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The callback to be invoked when the image fails to load. |