TabRow
Composable Component
TV-Material Design Horizontal TabRow
Android
@Composable
fun TabRow(
selectedTabIndex: Int,
modifier: Modifier = Modifier,
containerColor: Color = TabRowDefaults.ContainerColor,
contentColor: Color = TabRowDefaults.contentColor(),
separator: @Composable () -> Unit = { TabRowDefaults.TabSeparator() },
indicator: @Composable (tabPositions: List<DpRect>, doesTabRowHaveFocus: Boolean) -> Unit =
@Composable { tabPositions, doesTabRowHaveFocus ->
tabPositions.getOrNull(selectedTabIndex)?.let { currentTabPosition ->
TabRowDefaults.PillIndicator(
currentTabPosition = currentTabPosition,
doesTabRowHaveFocus = doesTabRowHaveFocus
)
}
},
tabs: @Composable TabRowScope.() -> Unit
)
Parameters
selectedTabIndex | the index of the currently selected tab |
modifier | the Modifier to be applied to this tab row |
containerColor | the color used for the background of this tab row |
contentColor | the primary color used in the tabs |
separator | use this composable to add a separator between the tabs |
indicator | used to indicate which tab is currently selected and/or focused. This lambda provides 2 values: |
tabs | a composable which will render all the tabs |