Infinite Scroll

Infinite Scroll allows to load additional content or do any other required action when page scroll is near to the bottom.

TypeResource
DesignFigma
MobileMobile Storybook
CodeGitlab

Infinite Scroll Preview

Usage

import id.co.biofarma.binduiandroid.components.infinite_scroll.InfiniteScroll
InfiniteScroll(
    id = "preview",
    contentItems = items,
    isLoading = true,
    loadMoreItems = {
        isLoading = true
        CoroutineScope(Dispatchers.IO).launch {
            delay(2000) // Simulate network delay
            val newItems: List<@Composable () -> Unit> = (items.size + 1..items.size + 20).map { index ->
                { SampleItemComponent("Item $index") }
            }
            withContext(Dispatchers.Main) {
                items = items + newItems
                isLoading = false
            }
        }
    },
    loadingType = "spinner",
    loadingSize = "sm",
    buffer = 5,
    loadingText = "Loading Content"
)

Examples

Loading Type

Use loading type spinner, dot or horizontal to use a loading type for infinite scroll.

Infinite Scroll Example Loading Type


Loading Size

Use loading size xs, sm, md, lg, or xl to use a loading size for infinite scroll.

Infinite Scroll Example Loading Size


Props

PropsRequiredDefaultTypedescription
idfalse-stringA unique identifier for the infinite scroll.
contentItemsfalse-List<@Composable () -> Unit> = listOf()List of list content displayed for infinite scroll.
isLoadingfalsefalsebooleanIf true, will display loading while scrolling.
loadMoreItemsfalse-List<@Composable () -> Unit> = listOf()Function to load data when scrolling.
loadingTypefalsespinnerspinner , dot , horizontalThe type variant of the loading (spinner, dot , horizontal).
loadingSizefalsemdxs, sm, md, lg, xlThe size of loading component (xs, sm, md, lg, xl).
loadingTextfalse-stringA unique identifier loading text for the infinite scroll.
bufferfalse5intThe buffer value used for infinite scroll.
BIND © Biofarma Innovate Next-level Design .