Adding items interactively
We have just learned how to remove items interactively. What about adding new items? Let’s look into it. First, let’s add a button to the top of our list:
Column(
    modifier =
        Modifier.padding(innerPadding).fillMaxWidth()
) {
    Button(onClick = {}) {
        Text(text = "Add Employee")
    }
    Employees( ... ) { ... }
}
Note that we moved the padding modifier from Employees to the Column composable because it should be applied to the outermost composable. We now have a button above our list for adding employees.
In a production app, you could add a rationale about what a new item would be. For example, you could have a form for a user to fill in different details. For the sake of simplicity, in our example, we will always add the same dummy item ...
 
                                             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
             
     
         
                 
                 
                