Use for switching between multiple views within the same context.
colorControls which variables are used to color the tab controls.
undefined (default)
--t-tab-active and --t-tab-inactive.alt
--t-tab-alt-active and --t-tab-alt-inactive.inherit.nameUsed to establish a relationship between q2-tab-container and its associated tab panes.
The element can fail if this property is not set. Nested tab containers without the name property will not render correctly.
noPrintno-printControls visibility of tab list in a print view. Tab content will still be visible even if noPrint is true.
orientationThe orientation of the tab strip.
horizontal (default) — tabs run left-to-right above the panel content.vertical — tabs stack top-to-bottom beside the panel content.Vertical orientation is intended for wider layouts (e.g. admin consoles). At viewports narrower than 768px, the component falls back to horizontal.
typeDetermines the font size of the tab controls.
valueCorresponds to the value of the selected tab pane.
The q2-tab-container element exposes events that can be used to send and receive data from the component based on user interaction.
Emitted when the selected tab changes.
{ value: string; }If an event handler is bound to the element using:
ontctChange property - The default handler will not fire, and the value must be updated in the custom handler.addEventListener("tctChange") method - The default handler will fire alongside the custom handler.The q2-tab-container element exposes methods that can be used to perform various actions on the component.
A method to select a tab pane corresponding with the value.
selectTab(value: string) => Promise<void>Secondary tab styles are available when you want a tabbed view outside the main page content (such as in a sidebar), or when you want to nest a tab view within another tab. To implement the secondary tab styles:
type="section" on the secondary or nested tabs to provide visual distinction from top-level tabs. Doing so sets font-size: inherit on the nested tab controls.color="alt" on the secondary or nested tabs. This sets color: inherit on the nested tab controls, avoiding text contrast issues.<q2-tab-container value="1-1" name="top">
<q2-tab-pane label="First Tab" value="1-1" name="top">
<strong>First tab</strong> content. — The nested tabs below are within this tab's content.
<q2-tab-container type="section" value="2-1" color="alt" name="child">
<q2-tab-pane label="First Nested Tab" value="2-1" name="child">
<strong>First nested tab</strong> content.
</q2-tab-pane>
<q2-tab-pane label="Second Nested Tab" value="2-2" name="child">
<strong>Second nested tab</strong> content.
</q2-tab-pane>
</q2-tab-container>
</q2-tab-pane>
<q2-tab-pane label="Second Tab" value="1-2" name="top">
<strong>Second tab</strong> content.
</q2-tab-pane>
</q2-tab-container>
Set orientation="vertical" to stack the tab strip beside the panel content rather than above it. This is intended for wider layouts such as admin consoles, where horizontal screen real estate is plentiful and a left-rail navigation pattern is preferred. Below 768px viewports the container automatically falls back to horizontal layout, so vertical is not recommended for narrow-viewport or mobile experiences.
<q2-tab-container orientation="vertical" name="vertical-example" value="v-1">
<q2-tab-pane label="Overview" value="v-1" name="vertical-example">
<strong>Overview</strong> content.
</q2-tab-pane>
<q2-tab-pane label="Details" value="v-2" name="vertical-example">
<strong>Details</strong> content.
</q2-tab-pane>
<q2-tab-pane label="Activity" value="v-3" name="vertical-example" badge-count="4">
<strong>Activity</strong> content with a badge count.
</q2-tab-pane>
<q2-tab-pane label="Settings" value="v-4" name="vertical-example">
<strong>Settings</strong> content.
</q2-tab-pane>
</q2-tab-container>
Vertical tab containers also come with CSS custom properties that let you tune the layout. Use --tct-tab-container-width to control the width of the strip itself, --tct-vertical-tab-container-padding to control the padding inside the strip, and --tct-vertical-tab-container-content-padding to control the padding of the content area.
The following keyboard commands will navigate between tabs and into the tab content:
Tab key to focus an individual tab in the tab container.← key focuses the previous tab.→ key focuses the next tab.orientation="vertical", the ↑ and ↓ keys also focus the previous and next tab, respectively.Tab key focuses the first focusable item within the focused tab's content.Home key focuses the first tab.End key focuses the last tab.Space and Enter keys display the focused tab.The Nielsen/Norman Group's tab article provides helpful guidance on using tabs in a design. The key guidelines:
The following CSS variables are available to override the default theme styles of the q2-tab-container component.
Many Tecton components consume other components to maintain visual and functional consistency. If you are looking for a CSS variable you think should exist but are not seeing it, it may be defined in one of the dependent components below. Either way, if you think it's something we should expose more conveniently, let us know!
This component uses other components in the Tecton library, including:
q2-badgeq2-btnq2-iconThe changelog provides a detailed history of new features, improvements, and bug fixes going back to Tecton 1.30.0. If the button is disabled, it indicates there have been no detectable changes since then.