Hello guys, in my early days programming in SWT I created a UI with Tabs, here is an example
https://www.roseindia.net/tutorials/swt/create-tabs.shtml
Is there a way to do the same in compose for desktop? Any link to documentation or example would be nice. Or other reason why not to go that way.
d
Didier Villevalois
11/25/2021, 1:29 PM
Something like this?
Copy code
@Composable
fun MyAppTabs() {
var tabIndex by remember { mutableStateOf(0) }
val tabTitles = listOf("Hello", "There", "World")
Column {
TabRow(selectedTabIndex = tabIndex) {
tabTitles.forEachIndexed { index, title ->
Tab(
selected = tabIndex == index,
onClick = { tabIndex = index },
text = { Text(text = title) }
)
}
}
when (tabIndex) {
0 -> Text("Hello content")
1 -> Text("There content")
2 -> Text("World content")
}
}
}