Tabs give customers the ability to view only the content they are interested in or easily switch between content. A tab label describes the tab’s associated grouping of content.
Keep the label character count short and succinct. We recommend a maximum of 12 characters and no more than four tabs.
While tabs and a navigation bar may seem to have a similar purpose, they have a strong cognitive difference. The content of each tab is considered to be related to that of the others and selecting between them keeps the customer on the same page. In a navigation bar, however, the content of each section isn’t necessarily related to the others, and making a selection will open up that content in a separate view.
The tabs list supports keyboard shortcuts to easily navigate through the tabs. Using the left ← and right → arrow keys moves focus to the next and previous tab respectively. Use the Home key to focus the first tab and the End key to focus the last tab. Users can then press Space or Enter to activate that tab. Specifying data-activation-type="automatic" on the tabs container will automatically select the tab when it receives focus as well.
By default data-activation-type="manual" is specified. If the individual tab panels can be displayed without noticeable latency, then the automatic activation type is recommended, allowing users to quickly navigate through the tabs. For more details on making this decision, check the WAI-ARIA Authoring Practices
The DLS tabs component requires both dls.css and dls.js due to the complexities involved with its logic, functionality, and animations.
Component Width = 100% of the parent container
Individual Tab Width = The width of each tab is determined by dividing the component width by the number of tabs
Fill = Gray 01 (default), White (active), Gray 02 (hover)
Left and Right Padding = Responsive and aligns to gutter breakpoints, i.e. 20px on large
Font = Body 1, Bright Blue (default), Deep Blue (selected)
Stroke = 1px, Gray 02
Bar = 4px, Deep Blue (selected)
Character Count = As minimal as possible for scrolling, no more than 30 characters (including spaces)
Class Name = .tabs
For breakpoints 1023px and below, tabs become scrollable. Text is confined to one line when scrolling, even if it drops to two lines in desktop.
Tapping on a tab will switch its state to active and content will change below.
<div class="tabs border" data-toggle="tabs">
<div class="tab-menu" role="tablist">
<button id="tab1" class="tab-link pad-responsive-lr" role="tab" aria-selected="true" aria-controls="tabpanel1">
<span>Pay with Points</span>
</button>
<button id="tab2" class="tab-link pad-responsive-lr" role="tab" aria-selected="false" aria-controls="tabpanel2" tabindex="-1">
<span>Redeem for Gift Cards</span>
</button>
<button id="tab3" class="tab-link pad-responsive-lr" role="tab" aria-selected="false" aria-controls="tabpanel3" tabindex="-1">
<span>Added to Card</span>
</button>
</div>
<div class="tab-content pad-tb pad-responsive-lr">
<div role="tabpanel" id="tabpanel1" aria-labelledby="tab1">
Tab 1 content
</div>
<div class="hidden" id="tabpanel2" role="tabpanel" aria-labelledby="tab2">
Tab 2 content
</div>
<div class="hidden" id="tabpanel3" role="tabpanel" aria-labelledby="tab3">
Tab 3 content
</div>
</div>
</div><div class="tabs border" data-toggle="tabs" data-activation-type="automatic">
<div class="tab-menu" role="tablist">
<button class="tab-link pad-responsive-lr" role="tab" id="tablink1" aria-selected="true" aria-controls="tablinkpanel1">
<span>Pay with Points at Checkout</span>
</button>
<button class="tab-link pad-responsive-lr" role="tab" id="tablink2" aria-selected="false" aria-controls="tablinkpanel2" tabindex="-1">
<span>Redeem for Gift Cards</span>
</button>
<button class="tab-link pad-responsive-lr" role="tab" id="tablink3" aria-selected="false" aria-controls="tablinkpanel3" tabindex="-1">
<span>Cover Card Charges</span>
</button>
<button class="tab-link pad-responsive-lr" role="tab" id="tablink4" aria-selected="false" aria-controls="tablinkpanel4" tabindex="-1">
<span>Book Travel</span>
</button>
<button class="tab-link pad-responsive-lr" role="tab" id="tablink5" aria-selected="false" aria-controls="tablinkpanel5" tabindex="-1">
<span>Transfer Points</span>
</button>
<button class="tab-link pad-responsive-lr" role="tab" id="tablink6" aria-selected="false" aria-controls="tablinkpanel6" tabindex="-1">
<span>Go Shopping</span>
</button>
</div>
<div class="tab-content pad-tb pad-responsive-lr">
<div id="tablinkpanel1" role="tabpanel" aria-labelledby="tablink1">
Tab 1 content
</div>
<div class="hidden" id="tablinkpanel2" role="tabpanel" aria-labelledby="tablink2">
Tab 2 content
</div>
<div class="hidden" id="tablinkpanel3" role="tabpanel" aria-labelledby="tablink3">
Tab 3 content
</div>
<div class="hidden" id="tablinkpanel4" role="tabpanel" aria-labelledby="tablink4">
Tab 4 content
</div>
<div class="hidden" id="tablinkpanel5" role="tabpanel" aria-labelledby="tablink5">
Tab 5 content
</div>
<div class="hidden" id="tablinkpanel6" role="tabpanel" aria-labelledby="tablink6">
Tab 6 content
</div>
</div>
</div>Though icons can be used within tabs to help give context to the content, don’t overuse them. Make sure the icons within the tabs work with other icons on the page.
Component Width = 100% of the parent container
Individual Tab Width = The width of each tab is determined by dividing the component width by the number of tabs
Fill = Gray 01 (default), White (active), Gray 02 (hover)
Left and Right Padding = Responsive and aligns to gutter breakpoints, i.e. 20px on large
Icon = Small, Deep Blue (active, filled), Bright Blue (default, outline)
Font = Body 1, Bright Blue (default), Deep Blue (selected)
Text Line = Limit to 1 line of text when using an icon
Stroke = 1px, Gray 02
Bar = 4px, Deep Blue (selected)
Class Name = .tabs
For breakpoints 1023px and below, tabs become scrollable. Text is confined to one line when scrolling. Icons are removed.
<div class="tabs border" data-toggle="tabs">
<div class="tab-menu" role="tablist">
<button id="tabIcon1" class="tab-link pad-responsive-lr" role="tab" aria-selected="true" aria-controls="tabIconPanel1">
<i class="margin-1-b" data-dls-icon="card-swipe" data-dls-icon-variant="filled" data-dls-icon-size="md" data-dls-icon-role="decorative"></i>
<span>Pay with Points at Checkout</span>
</button>
<button id="tabIcon2" class="tab-link pad-responsive-lr" role="tab" aria-selected="false" aria-controls="tabIconPanel2" tabindex="-1">
<i class="margin-1-b" data-dls-icon="gift" data-dls-icon-size="md" data-dls-icon-role="decorative"></i>
<span>Redeem for Gift Cards</span>
</button>
<button id="tabIcon3" class="tab-link pad-responsive-lr" role="tab" aria-selected="false" aria-controls="tabIconPanel3" tabindex="-1">
<i class="margin-1-b" data-dls-icon="airplane" data-dls-icon-size="md" data-dls-icon-role="decorative"></i>
<span>Book Travel</span>
</button>
<button id="tabIcon4" class="tab-link pad-responsive-lr" role="tab" aria-selected="false" aria-controls="tabIconPanel4" tabindex="-1">
<i class="margin-1-b" data-dls-icon="change" data-dls-icon-size="md" data-dls-icon-role="decorative"></i>
<span>Transfer Points</span>
</button>
</div>
<div class="tab-content pad-tb pad-responsive-lr">
<div id="tabIconPanel1" role="tabpanel" aria-labelledby="tabIcon1">
Tab 1 content
</div>
<div class="hidden" id="tabIconPanel2" role="tabpanel" aria-labelledby="tabIcon2">
Tab 2 content
</div>
<div class="hidden" id="tabIconPanel3" role="tabpanel" aria-labelledby="tabIcon3">
Tab 3 content
</div>
<div class="hidden" id="tabIconPanel4" role="tabpanel" aria-labelledby="tabIcon4">
Tab 4 content
</div>
</div>
</div>If you are using dls.js, reference the attributes below for functionality.
| Attribute Name | Options | Description |
|---|---|---|
data-toggle |
tabs |
Creates a tab object; required for dls.js functionality. |
data-activation-type |
manual/automatic |
Specifies if selection should follow focus. By default, "manual" activation is used. See "Activation Types" above for more details. |
aria-selected |
true/false |
Indicates which tab panel is currently showing or not. |