# SecondaryTabRow

> SecondaryTabRow from Material 3 Compose (`androidx.compose.material3:material3`) for Jetpack Compose, with a code sample.

- Library: [Material 3 Compose](https://composables.com/material-components/material-3-compose.md)
- Category: [Tabs](https://composables.com/material-components/tabs.md)
- API reference and more examples: [SecondaryTabRow](https://composables.com/jetpack-compose/androidx.compose.material3/material3/components/SecondaryTabRow/api.md)

## Code

```kotlin
@Composable

@OptIn(ExperimentalMaterial3Api::class)
fun SecondaryTextTabs() {
    var state by rememberSaveable { mutableStateOf(0) }
    val titles = listOf("Tab 1", "Tab 2", "Tab 3 with lots of text")
    Column {
        SecondaryTabRow(selectedTabIndex = state) {
            titles.forEachIndexed { index, title ->
                Tab(
                    selected = state == index,
                    onClick = { state = index },
                    text = { Text(text = title, maxLines = 2, overflow = TextOverflow.Ellipsis) },
                )
            }
        }
        Text(
            modifier = Modifier.align(Alignment.CenterHorizontally),
            text = "Secondary tab ${state + 1} selected",
            style = MaterialTheme.typography.bodyLarge,
        )
    }
}
```
