New Compose Multiplatform components arrived on Composables UICheck it out →

Component in Tv Foundation

TvLazyHorizontalGrid

Android

A lazy horizontal grid layout. It composes only visible columns of the grid.

Last updated:

Installation

dependencies {
   implementation("androidx.tv:tv-foundation:1.0.0-alpha10")
}

Overloads

@Composable
fun TvLazyHorizontalGrid(
    rows: TvGridCells,
    modifier: Modifier = Modifier,
    state: TvLazyGridState = rememberTvLazyGridState(),
    contentPadding: PaddingValues = PaddingValues(0.dp),
    reverseLayout: Boolean = false,
    horizontalArrangement: Arrangement.Horizontal =
        if (!reverseLayout) Arrangement.Start else Arrangement.End,
    verticalArrangement: Arrangement.Vertical = Arrangement.Top,
    userScrollEnabled: Boolean = true,
    pivotOffsets: PivotOffsets = PivotOffsets(),
    content: TvLazyGridScope.() -> Unit
)

Parameters

namedescription
rowsa class describing how cells form rows, see [TvGridCells] doc for more information
modifierthe modifier to apply to this layout
statethe state object to be used to control or observe the list's state
contentPaddingspecify a padding around the whole content
reverseLayoutreverse the direction of scrolling and layout, when true items will be composed from the end to the start and [TvLazyGridState.firstVisibleItemIndex] == 0 will mean the first item is located at the end.
verticalArrangementThe vertical arrangement of the layout's children
horizontalArrangementThe horizontal arrangement of the layout's children
pivotOffsetsoffsets that are used when implementing Scrolling with Offset
userScrollEnabledwhether the scrolling via the user gestures or accessibility actions is allowed. You can still scroll programmatically using the state even when it is disabled.
pivotOffsetsoffsets of child element within the parent and starting edge of the child from the pivot defined by the parentOffset.
contentthe [TvLazyGridScope] which describes the content