CamoCarousel
A strip of items you swipe or step through. state is Compose's PagerState (its currentPage, and
animateScrollToPage to jump). layout Peek lets the next item show at the edge. Previous and next buttons
show on pointer devices by default (showButtons); Left and Right (reading direction), Home and End step
and jump; the page dots are CamoPagination's. Each item announces "item 2 of 5"; caption names the
carousel. There is no auto-play. itemKey must be a type Android can save in a Bundle (a String or a number): a
Color.value (a ULong) throws "Type of the key is not supported" on Android.
API
- Kotlin
- Dart
public fun <T> CamoCarousel(
items: List<T>,
itemKey: (T) -> Any,
caption: String,
modifier: Modifier = Modifier,
state: PagerState = rememberPagerState { items.size },
layout: CarouselLayout = CarouselLayout.Paged,
showButtons: Boolean = Camouflage.environment.input == InputMode.Pointer,
showIndicator: Boolean = true,
content: @Composable (T) -> Unit,
)
| Name | Type | Default |
|---|---|---|
items | List<T> | required |
itemKey | (T) -> Any | required |
caption | String | required |
modifier | Modifier | Modifier |
state | PagerState | rememberPagerState { items.size } |
layout | CarouselLayout | CarouselLayout.Paged |
showButtons | Boolean | Camouflage.environment.input == InputMode.Pointer |
showIndicator | Boolean | true |
content | @Composable (T) -> Unit | required |
Design notes
Why CamoCarousel works this way, its states and its edge cases: contributor docs.