Phosphor::TabsMock
Inherits Phosphor::MockWidget < Reference < Object
A tab bar that communicates which content panel is currently active.
Generic and app-agnostic: no knowledge of AppState, Msg, or the
application theme. The Widget wrapper resolves theme → Style values
and sets them in Props before each render.
active_index lives in Props, not WidgetState: the owning Widget
drives it from AppState via sync, so TabsMock never maintains its
own notion of which tab is active — it renders whatever Props says.
Distinct from MenuMock because one tab is always visually active.
Constructors
Initialises the tab bar with props and an optional state. No
extra render state is needed beyond the base WidgetState.
Instance methods
Responds to tab-navigation commands.
Cmd::TabNext—props.active_index+ 1, wrapping to 0.Cmd::TabPrev—props.active_index− 1, wrapping to the last tab.- Any other command, or navigation on an empty
props.tabs— returnsCmdResult::None.
Renders every tab label in a single row at frame.y, separated by
props.separator (written in props.inactive_style). The tab at
props.active_index is written in props.active_style; every other
tab in props.inactive_style. Stops as soon as the row would exceed
frame.width — trailing tabs are truncated, not the row itself.