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

← Back to Tv Material

Tab

Component
in
Tv Material
. Since 1.0.0-alpha07

Overview

Code Examples

Video

Material Design tab.

A default Tab, also known as a Primary Navigation Tab. Tabs organize content across different screens, data sets, and other interactions.

This should typically be used inside of a TabRow, see the corresponding documentation for example usage.

@param selected whether this tab is selected or not @param onFocus called when this tab is focused @param modifier the Modifier to be applied to this tab @param onClick called when this tab is clicked (with D-Pad Center) @param enabled controls the enabled state of this tab. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services. @param colors these will be used by the tab when in different states (focused, selected, etc.) @param interactionSource the MutableInteractionSource representing the stream of Interactions for this tab. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this tab in different states. @param content content of the Tab

Overloads

Tab

@Composable
fun Tab(
  selected: Boolean,
  onFocus: () -> Unit,
  modifier: Modifier = Modifier,
  onClick: () -> Unit = { },
  enabled: Boolean = true,
  colors: TabColors = TabDefaults.pillIndicatorTabColors(),
  interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
  content: @Composable RowScope.() -> Unit
)

Parameters

NameDescription
selectedwhether this tab is selected or not
onFocuscalled when this tab is focused
modifierthe Modifier to be applied to this tab
onClickcalled when this tab is clicked (with D-Pad Center)
enabledcontrols the enabled state of this tab. When false, this component will not respond to user input, and it will appear visually disabled and disabled to accessibility services.
colorsthese will be used by the tab when in different states (focused, selected, etc.)
interactionSourcethe MutableInteractionSource representing the stream of Interactions for this tab. You can create and pass in your own remembered instance to observe Interactions and customize the appearance / behavior of this tab in different states.
contentcontent of the Tab