LazyRow for Carousels
Build a horizontally scrolling shelf.
LazyRow for Carousels is a free Jetpack Compose Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Jetpack Compose Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Scrolling Sideways
Sometimes content should slide left and right, like a movie shelf. For that you use LazyRow, the horizontal cousin of LazyColumn. ↔️
Why Not a Plain Row?
A plain Row composes every child immediately and cannot scroll. A LazyRow scrolls horizontally and only builds the items in view.
Basic LazyRow
You feed LazyRow items just like a column, but they line up side by side instead of stacking.
LazyRow {
items(movies) { movie ->
MovieCard(movie)
}
}Spacing Cards Apart
Carousel cards need gaps. Use horizontalArrangement with spacedBy to set a consistent space between each card.
LazyRow(
horizontalArrangement = Arrangement.spacedBy(12.dp)
) { }Padding at the Ends
Add contentPadding so the first card peeks in from the edge instead of being clipped flush against it.
contentPadding = PaddingValues(horizontal = 16.dp)Sizing Each Card
Give each carousel item a fixed width so cards stay uniform as the user swipes through them.
MovieCard(movie, Modifier.width(140.dp))A Peek of the Next Card
Make a fraction of the next card visible to hint there is more. A slightly smaller card width relative to the screen does this nicely.
val cardWidth = screenWidth * 0.8f
MovieCard(movie, Modifier.width(cardWidth))Headers Above Carousels
A carousel usually sits under a title. Compose the LazyRow inside a Column, with a Text header above it.
Column {
Text("Trending Now")
LazyRow { items(movies) { MovieCard(it) } }
}Nesting in a LazyColumn
A home screen often stacks many carousels. Place several LazyRow rows inside a parent LazyColumn for a Netflix-style feed.
LazyColumn {
items(shelves) { shelf ->
Shelf(shelf)
}
}Each Row Needs Width
A LazyRow inside a LazyColumn fills the available width automatically. Just ensure the parent gives it a finite width to measure against.
When to Use LazyRow
Reach for LazyRow for shelves, chip filters, story bubbles, and any content that invites a horizontal swipe rather than a downward scroll.
Quick Check
Think about horizontal scrolling.
Recap: Carousels
You built horizontal shelves with LazyRow: side-by-side items, spacing, end padding, fixed-width cards, and nesting inside a feed. 🎬
Frequently asked questions
Is the “LazyRow for Carousels” lesson free?
Yes — the full text of “LazyRow for Carousels” is free to read here on the web, and the Jetpack Compose Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Jetpack Compose Academy course, upgrade to CoddyKit PRO.
What will I learn in “LazyRow for Carousels”?
Build a horizontally scrolling shelf. You practise Jetpack Compose Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Jetpack Compose Academy?
No prior experience is required. Jetpack Compose Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “LazyRow for Carousels” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Jetpack Compose Academy lesson?
Yes. Every Jetpack Compose Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.