Use for switching between multiple views within the same context.
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.First tab content.
The nested tabs below are within this tab's content.
First nested tab content.
Second nested tab content.
Second tab content.
Notice that the nested tabs from "First tab" are no longer present.
<q2-tab-container value="1-1" name="top">
<q2-tab-pane label="First Tab" value="1-1" name="top">
<p><strong>First tab</strong> content.</p>
<p>The nested tabs below are within this tab's content.</p>
<q2-tab-container type="section" value="2-1" color="alt" name="child">
<q2-tab-pane label="First Nested Tab" value="2-1" name="child">
<p><strong>First nested tab</strong> content.</p>
</q2-tab-pane>
<q2-tab-pane label="Second Nested Tab" value="2-2" name="child">
<p><strong>Second nested tab</strong> content.</p>
</q2-tab-pane>
</q2-tab-container>
</q2-tab-pane>
<q2-tab-pane label="Second Tab" value="1-2" name="top">
<p><strong>Second tab</strong> content.</p>
<p>Notice that the nested tabs from "First tab" are no longer present.</p>
</q2-tab-pane>
</q2-tab-container>
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.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.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.
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:
onchange property - The default handler will not fire, and the value must be updated in the custom handler.addEventListener("change") method - The default handler will fire alongside the custom handler.Emitted when the component has finished rendering.
undefinedEmitted 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>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!