Tabs Beta
<tg2-tabs><tg2-tab>tg-tabtg-tab-headingtg-tab-contenttg-tabs
Give every tablist an accessible name with ariaLabel[(selected)]selectedChange
Using tg2-tabs on a page that still has the old Tangram design? Set theme="tg-light"
Sizes
Three sizes: smallmediumlargetg2Button
Small Default
Medium
Large
Icons
iconLefticonRight
Small Default
Medium
Large
Disabled tabs
A disabled tab is removed from the Tab and arrow-key sequences (Home and End skip over it too) and cannot be activated by click.
Second tab disabled
Overflow
When the tabs are wider than their container the strip scrolls horizontally and fades at the clipped edge, the same treatment as tg-tabsselected
Twelve tabs
Keyboard navigation
/Tab — step through each tab in order, then on into the selected panel, as inShift+Tabtg-tabs /ArrowLeft — move focus between tabs from whichever tab has focus, wrapping at the ends, without changing the selected tabArrowRight /Home — move focus to the first / last enabled tabEnd /Enter — select the focused tabSpace- Disabled tabs are skipped automatically
- Activation is manual, as in
: arrowing onto a tab shows its focus ring but leaves the panel unchangedtg-tabs - An overflowing strip scrolls to keep the focused tab in view
Server-side rendering and hydration
Server-side rendered. The default. The user only sees the selected tab's content, but every tab's content is in the initial HTML, so search engines can index all of it:
<tg2-tabs
ariaLabel="Product details"
[(selected)]="selectedIndex">
<tg2-tab label="Details">
Panel one content
</tg2-tab>
<tg2-tab label="Reviews">
Panel two content
</tg2-tab>
<tg2-tab
label="Shipping"
disabled>
Panel three content
</tg2-tab>
</tg2-tabs>Hydrated. Use it for larger components to improve initial page performance. The server sends the placeholder and the component loads in the browser once its tab is active, even if that is the first tab. Gate it on the tab's active
<tg2-tabs [(selected)]="selectedTab">
<tg2-tab label="Overview">
<app-listing-overview />
</tg2-tab>
<tg2-tab #historyTab label="Price history">
@defer (when historyTab.active()) {
<app-price-history-chart />
} @placeholder {
<p>Chart loading…</p>
}
</tg2-tab>
</tg2-tabs> There is no lazy@defer