I have a TabRow like so: ``` Column(modifier) ...
# compose-desktop
d
I have a TabRow like so:
Copy code
Column(modifier) {
        TabRow(selectedTabIndex = activeTab()) {
            Tab(selected = activeTab() == 0, onClick = { activeTab(0) }, enabled = true) {
                Text("Tab 1", Modifier.padding(3.dp), textAlign = TextAlign.Center)
            }
            Tab(selected = activeTab() == 1, onClick = { activeTab(1) }, enabled = true) {
                Text("Search: Result", Modifier.padding(3.dp), textAlign = TextAlign.Center)
            }
            Tab(selected = activeTab() == 2, onClick = { activeTab(2) }, enabled = true) {
                Text("Tab 3", Modifier.padding(3.dp), textAlign = TextAlign.Center)
            }
        }
no matter what I try, I don't get the Tab Texts vertically centered. Isn't TabRow missing a "verticalAligment" parameter???
g
I'm having a similar issue but with a bottom header and just for a row, so I gave up and just have it some
top
padding and it did the trick
i
Just fix the
height
and add
fillMaxHeight()
to every
Tab
Copy code
Column {
    TabRow(selectedTabIndex = 0, Modifier.height(48.dp)) {
        Tab(selected = true, onClick = { }, enabled = true, modifier = Modifier.fillMaxHeight()) {
            Text("Tab 1", Modifier.padding(3.dp), textAlign = TextAlign.Center)
        }
        Tab(selected = false, onClick = { }, enabled = true, modifier = Modifier.fillMaxHeight()) {
            Text("Search: Result", Modifier.padding(3.dp), textAlign = TextAlign.Center)
        }
        Tab(selected = false, onClick = { }, enabled = true, modifier = Modifier.fillMaxHeight()) {
            Text("Tab 3", Modifier.padding(3.dp), textAlign = TextAlign.Center)
        }
    }
}
If you need a dynamic height (height is determined by `TabRow`'s content), you should use something like this
Copy code
CustomTabRow(selectedTabIndex = 0, Modifier.height(IntrinsicSize.Min))
Where
CustomTabRow
is a copy of
TabRow
, but without `SubcomposeLayout`(`SubcomposeLayout`doesn't support IntrinsicSize)
1
j
Will
SubcomposeLayout
ever support intrinsics ?
i
j
Thanks!