Scrollable lists can help manage datasets, create responsive designs, and facilitate navigation. You can display smaller sets of items in your app by using a finite scrolling list. To avoid performance issues with larger datasets or a list of unknown length, see Lazily load data with lists and Paging.
Version compatibility
This implementation requires that your project minSDK be set to API level 21 or higher.
Dependencies
Create a vertical scrolling list
Use the following code to create a vertical scrolling list:
@Composable private fun ScrollBoxes() { Column( modifier = Modifier .background(Color.LightGray) .size(100.dp) .verticalScroll(rememberScrollState()) ) { repeat(10) { Text("Item $it", modifier = Modifier.padding(2.dp)) } } }
Key points about the code
- Sets the
Column
scrolling behavior with theverticalScroll
modifier and therememberScrollState
function. - To create a horizontal scrolling list, create a
Row
with ahorizontalScroll
modifier.
Results
![A vertical list responding to scroll
gestures](/static/develop/ui/compose/images/gestures-simplescroll.gif)
Collections that contain this guide
This guide is part of these curated Quick Guide collections that cover broader Android development goals:
![](/static/images/quick-guides/collection-illustration.png)
Display a list or grid
![](/static/images/quick-guides/collection-illustration.png)
Display interactive components
![](/static/images/quick-guides/collection-illustration.png)