Skip to content

Latest commit

 

History

History
64 lines (51 loc) · 1.46 KB

File metadata and controls

64 lines (51 loc) · 1.46 KB
title
Android

Overview

TileGroup component is used for wrapping tiles to show related interactions.

Usage

TileGroup allows to add multiple Tiles and wrapping in a single elevated component.

@Composable
fun Example() {
    TileGroup(
        modifier = Modifier.padding(16.dp),
    ) {
        Tile(
            title = { Text("Title") },
            onClick = {},
        )
        Tile(
            title = { Text("Title") },
            onClick = {},
            icon = { Icon(Icons.Airplane, contentDescription = null) },
            description = { Text("Description") },
        )
    }
}

UI Testing

Slotting API allows you to configure the particular child Tiles with testTags.

composeTestRule.setContent {
    TileGroup(
        modifier = Modifier.padding(16.dp),
    ) {
        Tile(
            modifier = Modifier.testTag("title")
            title = { Text("Title") },
            onClick = {},
        )
        Tile(
            title = { Text("Title") },
            onClick = {},
            icon = { Icon(Icons.Airplane, contentDescription = null) },
            description = { Text("Description") },
        )
    }
}

composeTestRule.onNodeWithTag("title").assertTextEquals("Title")

Customization

separatorStartIndent can configure the start indentation of separators in-between child Tiles.