KwikCarousel

fun KwikCarousel(modifier: Modifier = Modifier, state: MutableState<KwikCarouselState>, shape: Shape = MaterialTheme.shapes.medium, initialIndex: Int = 0, showIndicators: Boolean = true, selectedIndicatorColor: Color = Color.White, unselectedIndicatorColor: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.5f), indicatorContainerColor: Color = MaterialTheme.colorScheme.surface.copy(alpha = 0.5f), showNavigation: Boolean = true, userScrollEnabled: Boolean = true, showCounter: Boolean = false, autoPlay: Boolean = false, autoPlayDelay: Long = 3000, onPageIndexChange: (Int) -> Unit = {}, prevButton: @Composable () -> Unit? = null, nextButton: @Composable () -> Unit? = null, contentBuilder: @Composable (page: Int) -> Unit)

A generic carousel that displays a list of content in a horizontal scrollable view.

Parameters

modifier

The modifier to be applied to the carousel (HorizontalPager).

shape

The shape of the carousel.

initialIndex

The index of the item to display first.

showIndicators

Whether to show the page indicators.

selectedIndicatorColor

The color of the selected page indicator.

unselectedIndicatorColor

The color of the unselected page indicator.

showNavigation

Whether to show the navigation buttons.

showCounter

Whether to show the counter.

autoPlay

Whether to automatically slide the carousel.

autoPlayDelay

The delay between auto-play slides in milliseconds.

onPageIndexChange

Callback that is invoked when the current page index changes.

userScrollEnabled

Whether the carousel is scrollable by the user.

prevButton

Optional composable to replace the default previous button.

nextButton

Optional composable to replace the default next button.

contentBuilder

Function that builds the content for each page.

Example usage:

KwikCarousel(
itemCount = 5
){ page ->
// Your content for the specific page
Text("Page $page")
}