A container control that organizes content into tabbed views. Users can switch between tabs to display different content. Supports top, bottom, left, and right tab positions with keyboard navigation.
Basic Usage
// Simple tab controlnewTabControl().AddTab(newTabItem().SetHeader("General").SetContent(newVStack().AddChildren(...))).AddTab(newTabItem().SetHeader("Advanced").SetContent(newVStack().AddChildren(...))).SetSelectedIndex(0)// Tabs at bottomnewTabControl().SetTabPosition(TabPosition.Bottom).AddTab(newTabItem().SetHeader("Home").SetContent(homePage)).AddTab(newTabItem().SetHeader("Settings").SetContent(settingsPage))// Vertical tabsnewTabControl().SetTabPosition(TabPosition.Left).AddTab(newTabItem().SetHeader("Profile").SetContent(profilePanel)).AddTab(newTabItem().SetHeader("Security").SetContent(securityPanel))
TabControl-Specific Methods
Tab Management
Method
Description
AddTab(TabItem)
Adds a tab to the control
RemoveTab(TabItem)
Removes a tab
ClearTabs()
Removes all tabs
SetTabs(IEnumerable<TabItem>)
Sets all tabs at once
BindTabs(name, getter)
Binds tabs collection
Selection Methods
Method
Description
SetSelectedIndex(int)
Sets selected tab by index
BindSelectedIndex(name, getter, setter?)
Binds selected index (optional two-way)
SetSelectedTab(TabItem)
Sets selected tab directly
BindSelectedTab(name, getter)
Binds selected tab
Position Methods
Method
Description
SetTabPosition(TabPosition)
Sets tab header position (default: Top)
BindTabPosition(name, getter)
Binds tab position
TabPosition Values
Value
Description
TabPosition.Top
Tabs at top (default)
TabPosition.Bottom
Tabs at bottom
TabPosition.Left
Tabs on left side
TabPosition.Right
Tabs on right side
Event Methods
Method
Description
SetOnSelectedIndexChanged(Action<int>)
Sets callback for tab changes
BindOnSelectedIndexChanged(name, getter)
Binds change callback
SetSelectionChangedCommand(ICommand)
Sets command for tab changes
BindSelectionChangedCommand(name, getter)
Binds selection command
Styling Methods
Method
Description
SetHeaderTextSize(float)
Sets tab header text size (default: 14)
BindHeaderTextSize(name, getter)
Binds header text size
SetHeaderTextColor(SKColor)
Sets inactive tab text color
BindHeaderTextColor(name, getter)
Binds header text color
SetActiveHeaderTextColor(SKColor)
Sets active tab text color (default: green)
BindActiveHeaderTextColor(name, getter)
Binds active text color
SetDisabledHeaderTextColor(SKColor)
Sets disabled tab text color
BindDisabledHeaderTextColor(name, getter)
Binds disabled text color
SetHeaderBackgroundColor(SKColor)
Sets header bar background
BindHeaderBackgroundColor(name, getter)
Binds header background
SetActiveTabBackgroundColor(SKColor)
Sets active tab background
BindActiveTabBackgroundColor(name, getter)
Binds active tab background
SetHoverTabBackgroundColor(SKColor)
Sets hover tab background
BindHoverTabBackgroundColor(name, getter)
Binds hover background
SetTabIndicatorColor(SKColor)
Sets active tab indicator color
BindTabIndicatorColor(name, getter)
Binds indicator color
SetTabIndicatorHeight(float)
Sets indicator height (default: 3)
BindTabIndicatorHeight(name, getter)
Binds indicator height
SetTabPadding(Margin)
Sets tab header padding (default: 16, 10)
BindTabPadding(name, getter)
Binds tab padding
SetTabSpacing(float)
Sets spacing between tabs (default: 0)
BindTabSpacing(name, getter)
Binds tab spacing
Keyboard navigation: Arrow Left/Right for horizontal tabs, Arrow Up/Down for vertical tabs. Disabled tabs are skipped.
TabItem
TabItem represents a single tab with header text and content.
newTabControl().SetTabPosition(TabPosition.Bottom).SetHeaderBackgroundColor(newSKColor(30,30,30)).SetTabIndicatorHeight(0)// No indicator.AddTab(newTabItem().SetHeader("Home").SetContent(homePage)).AddTab(newTabItem().SetHeader("Search").SetContent(searchPage)).AddTab(newTabItem().SetHeader("Profile").SetContent(profilePage))
newTabControl().SetHeaderTextColor(SKColors.Gray).SetActiveHeaderTextColor(SKColors.White).SetTabIndicatorColor(newSKColor(0,122,255))// Blue indicator.SetTabIndicatorHeight(4).SetActiveTabBackgroundColor(newSKColor(45,45,45)).SetHoverTabBackgroundColor(newSKColor(55,55,55)).SetTabSpacing(8).AddTab(newTabItem().SetHeader("Tab 1").SetContent(content1)).AddTab(newTabItem().SetHeader("Tab 2").SetContent(content2))