Logo

Tabs

Tabs enables users to switch among content panels using clickable tab headers. It provides an efficient way to present multiple related sections in a single interface area, with each tab containing distinct content defined by TabItem components.
Key features:
  • Content organization: Efficiently displays multiple content sections in a single interface area
  • Flexible orientation: Supports both horizontal (tabs on top) and vertical (tabs on side) layouts
  • Active tab control: Programmatically set which tab is initially selected
  • Custom tab styling: Configurable tab appearance via tabTemplate property
  • Navigation methods: Built-in methods for programmatic tab switching
Usage pattern: The component accepts only TabItem components as children. Other child components will not be displayed. Each TabItem has a label property for the tab button text, with content provided by placing child components within the TabItem.
<App>
  <Tabs>
    <TabItem label="Account">
      <Text>Account</Text>
    </TabItem>
    <TabItem label="Stream">
      <Text>Stream</Text>
    </TabItem>
    <TabItem label="Support">
      <Text>Support</Text>
    </TabItem>
  </Tabs>
</App>
Example: using Tabs
<App>
  <Tabs>
    <TabItem label="Account">
      <Text>Account</Text>
    </TabItem>
    <TabItem label="Stream">
      <Text>Stream</Text>
    </TabItem>
    <TabItem label="Support">
      <Text>Support</Text>
    </TabItem>
  </Tabs>
</App>

Properties

activeTab

This property indicates the index of the active tab. The indexing starts from 0, representing the starting (leftmost) tab. If not set, the first tab is selected by default.
<App>
  <Tabs activeTab="2">
    <TabItem label="Account">
      <Text>Account</Text>
    </TabItem>
    <TabItem label="Stream">
      <Text>Stream</Text>
    </TabItem>
    <TabItem label="Support">
      <Text>Support</Text>
    </TabItem>
  </Tabs>
</App>
Example: activeTab
<App>
  <Tabs activeTab="2">
    <TabItem label="Account">
      <Text>Account</Text>
    </TabItem>
    <TabItem label="Stream">
      <Text>Stream</Text>
    </TabItem>
    <TabItem label="Support">
      <Text>Support</Text>
    </TabItem>
  </Tabs>
</App>

orientation (default: "horizontal")

This property indicates the orientation of the component. In horizontal orientation, the tab sections are laid out on the left side of the content panel, while in vertical orientation, the buttons are at the top.
Available values: horizontal (default), vertical
<App>
  <Tabs orientation="horizontal">
    <TabItem label="Account">
      <Text>Account</Text>
    </TabItem>
    <TabItem label="Stream">
      <Text>Stream</Text>
    </TabItem>
    <TabItem label="Support">
      <Text>Support</Text>
    </TabItem>
  </Tabs>
</App>
Example: orientation
<App>
  <Tabs orientation="horizontal">
    <TabItem label="Account">
      <Text>Account</Text>
    </TabItem>
    <TabItem label="Stream">
      <Text>Stream</Text>
    </TabItem>
    <TabItem label="Support">
      <Text>Support</Text>
    </TabItem>
  </Tabs>
</App>

Events

This component does not have any events.

Exposed Methods

next

This method selects the next tab. If the current tab is the last one, it wraps around to the first tab.
Signature: next(): void

Styling

Theme Variables

VariableDefault Value (Light)Default Value (Dark)
backgroundColor-list-Tabsnonenone
backgroundColor-Tabsnonenone
backgroundColor-trigger-Tabsnonenone
backgroundColor-trigger-Tabs--activenonenone
backgroundColor-trigger-Tabs--hover$color-surface-100$color-surface-100
border-list-Tabsnonenone
border-trigger-Tabsnonenone
borderColor-active-Tabs$color-primary$color-primary
borderColor-Tabs$borderColor$borderColor
borderRadius-list-Tabsnonenone
borderRadius-trigger-Tabsnonenone
borderStyle-Tabssolidsolid
borderWidth-Tabs2px2px
padding-trigger-Tabs$space-4$space-4
paddingBottom-trigger-Tabsnonenone
paddingHorizontal-trigger-Tabsnonenone
paddingLeft-trigger-Tabsnonenone
paddingRight-trigger-Tabsnonenone
paddingTop-trigger-Tabsnonenone
paddingVertical-trigger-Tabsnonenone
textColor-trigger-Tabsnonenone
This site is an XMLUI™ app.