# PullRefreshIndicator

> PullRefreshIndicator from Material Compose (`androidx.compose.material:material`) for Jetpack Compose, with a code sample.

- Library: [Material Compose](https://composables.com/material-components/material-compose.md)
- API reference and more examples: [PullRefreshIndicator](https://composables.com/jetpack-compose/androidx.compose.material/material/components/PullRefreshIndicator/api.md)

## Code

```kotlin
@Composable
@OptIn(ExperimentalMaterialApi::class)
fun PullRefreshSample() {
    val refreshScope = rememberCoroutineScope()
    var refreshing by remember { mutableStateOf(false) }
    var itemCount by remember { mutableStateOf(15) }

    fun refresh() =
        refreshScope.launch {
            refreshing = true
            delay(1500)
            itemCount += 5
            refreshing = false
        }

    val state = rememberPullRefreshState(refreshing, ::refresh)

    Box(Modifier.pullRefresh(state)) {
        LazyColumn(Modifier.fillMaxSize()) {
            if (!refreshing) {
                items(itemCount) { ListItem { Text(text = "Item ${itemCount - it}") } }
            }
        }

        PullRefreshIndicator(refreshing, state, Modifier.align(Alignment.TopCenter))
    }
}
```
