TabContainerState¶
@Stable
class TabContainerState
Tracks which tab id is selected in a TabContainer. Create via rememberTabContainerState.
Properties¶
selectedTabId¶
val selectedTabId: String?
The currently selected tab's id, or null if nothing is selected yet.
Functions¶
ensureSelection¶
fun ensureSelection(tabs: List<TabSpec>)
Ensures the selection is valid for tabs: falls back to the first enabled tab (or the very first tab, if none are enabled) when there's no selection or the selected id no longer exists/is disabled among tabs.
isSelected¶
fun isSelected(tabId: String): Boolean
Whether tabId is the currently selected tab.
select¶
Selects the tab with the given tabId.
selectedIndex¶
fun selectedIndex(tabs: List<TabSpec>): Int
The index of the selected tab within tabs, or -1 if none is selected.
selectedTab¶
fun selectedTab(tabs: List<TabSpec>): TabSpec?