---
title: "mutableStateListOf"
description: "Create a instance of [MutableList]<T> that is observable and can be snapshot."
type: "function"
---

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


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
@StateFactoryMarker
public fun <T> mutableStateListOf(): SnapshotStateList<T>
```


Create a instance of `MutableList`<T> that is observable and can be snapshot.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
@StateFactoryMarker
public fun <T> mutableStateListOf(vararg elements: T): SnapshotStateList<T>
```


Create an instance of `MutableList`<T> that is observable and can be snapshot.



## Code Examples
### stateListSample
```kotlin
fun stateListSample() {
    @Composable
    fun Names() {
        var name by remember { mutableStateOf("user") }
        val names = remember { mutableStateListOf<String>() }
        Column {
            Row {
                BasicTextField(value = name, onValueChange = { name = it })
                Button(onClick = { names.add(name) }) { Text("Add") }
            }
            Text("Added names:")
            Column {
                for (addedName in names) {
                    Text(addedName)
                }
            }
        }
    }
}
```

