State of Compose 2023 results are in! Click here to learn more

← Back to Tv Foundation

TvLazyRow

Component
in
Tv Foundation
. Since 1.0.0-alpha07

Overview

Code Examples

Video

The horizontally scrolling list that only composes and lays out the currently visible items. The content block defines a DSL which allows you to emit items of different types. For example you can use TvLazyListScope.item to add a single item and TvLazyListScope.items to add a list of items.

@param modifier the modifier to apply to this layout @param state the state object to be used to control or observe the list's state @param contentPadding a padding around the whole content. This will add padding for the content after it has been clipped, which is not possible via modifier param. You can use it to add a padding before the first item or after the last one. If you want to add a spacing between each item use horizontalArrangement. @param reverseLayout reverse the direction of scrolling and layout. When true, items are laid out in the reverse order and TvLazyListState.firstVisibleItemIndex == 0 means that row is scrolled to the end. Note that reverseLayout does not change the behavior of horizontalArrangement, e.g. with Arrangement.Start 123### becomes 321###. @param horizontalArrangement The horizontal arrangement of the layout's children. This allows to add a spacing between items and specify the arrangement of the items when we have not enough of them to fill the whole minimum size. @param verticalAlignment the vertical alignment applied to the items @param userScrollEnabled whether the scrolling via the user gestures or accessibility actions is allowed. You can still scroll programmatically using the state even when it is disabled. @param pivotOffsets offsets of child element within the parent and starting edge of the child from the pivot defined by the parentOffset. @param content a block which describes the content. Inside this block you can use methods like TvLazyListScope.item to add a single item or TvLazyListScope.items to add a list of items.

Overloads

TvLazyRow

@Composable
fun TvLazyRow(
    modifier: Modifier = Modifier,
    state: TvLazyListState = rememberTvLazyListState(),
    contentPadding: PaddingValues = PaddingValues(0.dp),
    reverseLayout: Boolean = false,
    horizontalArrangement: Arrangement.Horizontal =
        if (!reverseLayout) Arrangement.Start else Arrangement.End,
    verticalAlignment: Alignment.Vertical = Alignment.Top,
    userScrollEnabled: Boolean = true,
    pivotOffsets: PivotOffsets = PivotOffsets(),
    content: TvLazyListScope.() -> Unit
)

Parameters

NameDescription
modifierthe modifier to apply to this layout
statethe state object to be used to control or observe the list's state
contentPaddinga padding around the whole content. This will add padding for the content after it has been clipped, which is not possible via modifier param. You can use it to add a padding before the first item or after the last one. If you want to add a spacing between each item use horizontalArrangement.
reverseLayoutreverse the direction of scrolling and layout. When true, items are laid out in the reverse order and TvLazyListState.firstVisibleItemIndex == 0 means that row is scrolled to the end. Note that reverseLayout does not change the behavior of horizontalArrangement, e.g. with Arrangement.Start 123### becomes 321###.
horizontalArrangementThe horizontal arrangement of the layout's children. This allows to add a spacing between items and specify the arrangement of the items when we have not enough of them to fill the whole minimum size.
verticalAlignmentthe vertical alignment applied to the items
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.
contenta block which describes the content. Inside this block you can use methods like TvLazyListScope.item to add a single item or TvLazyListScope.items to add a list of items