selectedPanel
Emits the panel tab the SDK currently displays.
Overview
Use selectedPanel to keep player-side controls — such as tab buttons or deep-link buttons —
in sync with the SDK's own tab bar. When the user switches tabs inside the SDK panel, or when
the host calls didShowPanel(), this flow
emits the newly active MaestroPanelType.
Syntax
val selectedPanel: Flow<MaestroPanelType?>
Returns
A Flow that emits the currently selected MaestroPanelType, or null when no panel is shown.
Example
import com.lessthan3.maestropanel.ui.topheader.MaestroPanelAvailability
import com.lessthan3.maestropanel.ui.topheader.MaestroPanelType
val availability by sdk.availablePanels.collectAsState(MaestroPanelAvailability.Loading)
val selected by sdk.selectedPanel.collectAsState(null)
val panels = (availability as? MaestroPanelAvailability.Available)?.panels.orEmpty()
panels.forEach { panel ->
PanelButton(
label = panel.name,
isSelected = panel == selected,
onClick = { sdk.didShowPanel(panel) },
)
}
Notes
- Emits
nullwhen the panel is hidden or no panel has been selected yet. - Use alongside
availablePanelsto both enumerate available panels and track which one is active.