Skip to content

Tabs

Tabs renders a controlled tab list.

Tabs(
{
TabItem("Overview"),
TabItem(app::images::activity, "Activity"),
std::move(TabItem("Reports")).Enabled(false),
},
selected
).OnChanged([selected](std::size_t index) {
selected = index;
})

Simple constructors accept string labels. TabItem adds raster or vector icons, icon-only presentation with a required semantic label, and per-item enabled state.

The selected index is controlled and must identify an item. OnChanged requests a new index; use that state to choose the corresponding page content.

Column {
Tabs({"Files", "Search", "History"}, selected)
.OnChanged([selected](std::size_t index) {
selected = index;
}),
selected == 0 ? FilesPage() : selected == 1 ? SearchPage() : HistoryPage(),
}

TabsStyle controls label states, icons, item geometry, optional equal expansion, divider, indicator color and sizing, and indicator motion. TabIndicatorSizing::Item follows the item; Content can produce a shorter content-width indicator.

Tabs expose tab-list, tab, selected, disabled, focus, and activation semantics.

  • Constructors: label lists or std::vector<TabItem>, followed by index or State<std::size_t>.
  • TabItem: label, icon plus label, IconOnly, and .Enabled(bool).
  • Event: .OnChanged(function) with std::size_t.
  • Theme style: TabsStyle and TabIndicatorSizing.