GlimmerLazyColumn

Functions summary

Unit
@Composable
GlimmerLazyColumn(
    modifier: Modifier,
    state: GlimmerLazyListState,
    contentPadding: PaddingValues,
    userScrollEnabled: Boolean,
    overscrollEffect: OverscrollEffect?,
    flingBehavior: FlingBehavior,
    reverseLayout: Boolean,
    horizontalAlignment: Alignment.Horizontal,
    verticalArrangement: Arrangement.Vertical,
    content: GlimmerLazyListScope.() -> Unit
)

This is a scrolling list component that only composes and lays out the currently visible items.

Unit
@Composable
GlimmerLazyColumn(
    title: @Composable () -> Unit,
    modifier: Modifier,
    state: GlimmerLazyListState,
    contentPadding: PaddingValues,
    userScrollEnabled: Boolean,
    overscrollEffect: OverscrollEffect?,
    flingBehavior: FlingBehavior,
    reverseLayout: Boolean,
    horizontalAlignment: Alignment.Horizontal,
    verticalArrangement: Arrangement.Vertical,
    content: GlimmerLazyListScope.() -> Unit
)

This is a scrolling list component that only composes and lays out the currently visible items.

Functions

GlimmerLazyColumn

@Composable
fun GlimmerLazyColumn(
    modifier: Modifier = Modifier,
    state: GlimmerLazyListState = rememberGlimmerLazyListState(),
    contentPadding: PaddingValues = GlimmerLazyColumnDefaults.contentPadding,
    userScrollEnabled: Boolean = true,
    overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
    flingBehavior: FlingBehavior = GlimmerLazyColumnDefaults.flingBehavior(state),
    reverseLayout: Boolean = false,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    verticalArrangement: Arrangement.Vertical = GlimmerLazyColumnDefaults.verticalArrangement,
    content: GlimmerLazyListScope.() -> Unit
): Unit

This is a scrolling list component that only composes and lays out the currently visible items. It is similar to androidx.compose.foundation.lazy.LazyColumn, but with extra functionality and customized behavior required for Jetpack Compose Glimmer. For Jetpack Compose Glimmer applications, it is recommended to use GlimmerLazyColumn instead of androidx.compose.foundation.lazy.LazyColumn, as it is specifically designed to provide seamless focus-based navigation, visual scrim edge effects and support for focus-aware snap behavior.

The content block defines a DSL which allows you to emit items of different types. For example, you can use GlimmerLazyListScope.item to add a single item and GlimmerLazyListScope.items to add a list of items.

See the other GlimmerLazyColumn overload for a variant with a title slot.

import androidx.xr.glimmer.ListItem
import androidx.xr.glimmer.Text
import androidx.xr.glimmer.list.GlimmerLazyColumn
import androidx.xr.glimmer.list.items

GlimmerLazyColumn {
    item { ListItem { Text("Header") } }
    items(count = 10) { index -> ListItem { Text("Item-$index") } }
    item { ListItem { Text("Footer") } }
}
Parameters
modifier: Modifier = Modifier

the modifier to apply to this layout.

state: GlimmerLazyListState = rememberGlimmerLazyListState()

the state object to be used to control or observe the list's state.

contentPadding: PaddingValues = GlimmerLazyColumnDefaults.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.

userScrollEnabled: Boolean = true

If user gestures are enabled.

overscrollEffect: OverscrollEffect? = rememberOverscrollEffect()

the OverscrollEffect that will be used to render overscroll for this layout. Note that the OverscrollEffect.node will be applied internally as well - you do not need to use Modifier.overscroll separately.

flingBehavior: FlingBehavior = GlimmerLazyColumnDefaults.flingBehavior(state)

logic describing fling and snapping behavior when drag has finished.

reverseLayout: Boolean = false

reverses the direction of scrolling and layout.

horizontalAlignment: Alignment.Horizontal = Alignment.Start

aligns items horizontally.

verticalArrangement: Arrangement.Vertical = GlimmerLazyColumnDefaults.verticalArrangement

is arrangement for items. This only applies if the content is smaller than the viewport.

content: GlimmerLazyListScope.() -> Unit

a block which describes the content. Inside this block you can use methods like GlimmerLazyListScope.item to add a single item or GlimmerLazyListScope.items to add a list of items.

GlimmerLazyColumn

@Composable
fun GlimmerLazyColumn(
    title: @Composable () -> Unit,
    modifier: Modifier = Modifier,
    state: GlimmerLazyListState = rememberGlimmerLazyListState(),
    contentPadding: PaddingValues = GlimmerLazyColumnDefaults.contentPaddingWithTitle,
    userScrollEnabled: Boolean = true,
    overscrollEffect: OverscrollEffect? = rememberOverscrollEffect(),
    flingBehavior: FlingBehavior = GlimmerLazyColumnDefaults.flingBehavior(state),
    reverseLayout: Boolean = false,
    horizontalAlignment: Alignment.Horizontal = Alignment.Start,
    verticalArrangement: Arrangement.Vertical = GlimmerLazyColumnDefaults.verticalArrangement,
    content: GlimmerLazyListScope.() -> Unit
): Unit

This is a scrolling list component that only composes and lays out the currently visible items. It is similar to androidx.compose.foundation.lazy.LazyColumn, but with extra functionality and customized behavior required for Jetpack Compose Glimmer. Jetpack Compose Glimmer applications should always use GlimmerLazyColumn instead of LazyColumn to ensure correct behavior.

The content block defines a DSL which allows you to emit items of different types. For example, you can use GlimmerLazyListScope.item to add a single item and GlimmerLazyListScope.items to add a list of items.

This overload of GlimmerLazyColumn contains a title slot. The title is expected to be a androidx.xr.glimmer.TitleChip. It is positioned at the top center and visually overlaps the list content. The list is vertically offset to start from the title's vertical center. When the list is scrolled, the title remains static.

See the other GlimmerLazyColumn overload for a variant with no title slot.

import androidx.xr.glimmer.ListItem
import androidx.xr.glimmer.Text
import androidx.xr.glimmer.TitleChip
import androidx.xr.glimmer.list.GlimmerLazyColumn
import androidx.xr.glimmer.list.items

val ingredientItems =
    listOf("Milk", "Flour", "Egg", "Salt", "Apples", "Butter", "Vanilla", "Sugar", "Cinnamon")
GlimmerLazyColumn(title = { TitleChip { Text("Ingredients") } }) {
    items(ingredientItems) { text -> ListItem { Text(text) } }
}
Parameters
title: @Composable () -> Unit

a composable slot for the list title, expected to be a androidx.xr.glimmer.TitleChip. It overlaps the list, positioned at the top-center, and remains stuck to the top when the list is scrolled.

modifier: Modifier = Modifier

applies to the layout that contains both list and title.

state: GlimmerLazyListState = rememberGlimmerLazyListState()

the state object to be used to control or observe the list's state.

contentPadding: PaddingValues = GlimmerLazyColumnDefaults.contentPaddingWithTitle

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. The list is vertically offset to start from the title's vertical center, so custom content paddings must provide sufficient space to avoid content being obscured.

userScrollEnabled: Boolean = true

If user gestures are enabled.

overscrollEffect: OverscrollEffect? = rememberOverscrollEffect()

the OverscrollEffect that will be used to render overscroll for this layout. Note that the OverscrollEffect.node will be applied internally as well - you do not need to use Modifier.overscroll separately.

flingBehavior: FlingBehavior = GlimmerLazyColumnDefaults.flingBehavior(state)

logic describing fling and snapping behavior when drag has finished.

reverseLayout: Boolean = false

reverses the direction of scrolling and layout.

horizontalAlignment: Alignment.Horizontal = Alignment.Start

aligns items horizontally.

verticalArrangement: Arrangement.Vertical = GlimmerLazyColumnDefaults.verticalArrangement

is arrangement for items. This only applies if the content is smaller than the viewport.

content: GlimmerLazyListScope.() -> Unit

a block which describes the content. Inside this block you can use methods like GlimmerLazyListScope.item to add a single item or GlimmerLazyListScope.items to add a list of items.