v1.6.x-dev NDS IQ v6

Tabs - National Design System

Group related content into a single surface where users switch between views without leaving the page

Standard Tabs

The default text-only tab strip. Reach for this when labels alone are enough to distinguish the panels and you want the broadest layout flexibility across vertical, divider, and card views.

Welcome

Welcome to our platform. Here you'll find the latest updates and important information about our services and offerings.

This is the main dashboard where users can quickly access key features and get an overview of their account status.

Getting Started

Explore the available services, review your recent activity, or configure your account preferences from the tabs above.

  • Browse available government services
  • Track your application status
  • Manage your profile and notifications
<div class="nds-tabs"> <div class="nds-tab-list-container nds-scroll-more"> <nav class="nds-tab-list nds-scroll-more-content" role="tablist" aria-label="Basic tab navigation"> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="true" aria-controls="panel-home" id="tab-home" tabindex="0" data-label="Home" type="button"> <span class="nds-label">Home</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-services" id="tab-services" tabindex="-1" data-label="Services" type="button"> <span class="nds-label">Services</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-about" id="tab-about" tabindex="-1" type="button"> <span class="nds-label">About</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-contact" id="tab-contact" tabindex="-1" type="button"> <span class="nds-label">Contact</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-support" id="tab-support" tabindex="-1" type="button"> <span class="nds-label">Support</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-resources" id="tab-resources" tabindex="-1" type="button"> <span class="nds-label">Resources</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-documentation" id="tab-documentation" tabindex="-1" type="button"> <span class="nds-label">Documentation</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-news" id="tab-news" tabindex="-1" type="button"> <span class="nds-label">News</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-feedback" id="tab-feedback" tabindex="-1" type="button"> <span class="nds-label">Feedback</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-settings" id="tab-settings" tabindex="-1" type="button"> <span class="nds-label">Settings</span> </button> </nav> <button class="nds-btn nds-subtle nds-tab nds-show-more" aria-label="Show more" type="button"><i class="nds-icon nds-hgi-arrow-down-01" aria-hidden="true"></i> </button> </div> <div class="nds-tab-content"> <div class="nds-tab-panel" role="tabpanel" id="panel-home" aria-labelledby="tab-home" tabindex="0"> <div class="nds-block"> <h3 class="nds-block-title">Welcome</h3> <p>Welcome to our platform. Here you'll find the latest updates and important information about our services and offerings.</p> <p>This is the main dashboard where users can quickly access key features and get an overview of their account status.</p> </div> <div class="nds-block"> <h3 class="nds-block-title">Getting Started</h3> <p>Explore the available services, review your recent activity, or configure your account preferences from the tabs above.</p> <ul> <li>Browse available government services</li> <li>Track your application status</li> <li>Manage your profile and notifications</li> </ul> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-services" aria-labelledby="tab-services" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Our Services</h3> <p>We offer a comprehensive range of digital government services designed to make your life easier.</p> <ul> <li>Document Processing</li> <li>Online Applications</li> <li>Digital Certificates</li> <li>Support Services</li> </ul> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-about" aria-labelledby="tab-about" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">About Us</h3> <p>The National Design System is part of Saudi Arabia's digital transformation initiative, providing consistent and accessible user experiences across all government digital services.</p> <p>Our mission is to create unified, user-friendly interfaces that serve citizens efficiently and effectively.</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-contact" aria-labelledby="tab-contact" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Contact Information</h3> <p>Get in touch with us through the following channels:</p> <p><strong>Email:</strong> support@nds.gov.sa</p> <p><strong>Phone:</strong> 920-000-000</p> <p><strong>Address:</strong> National Design System, Riyadh, Saudi Arabia</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-support" aria-labelledby="tab-support" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Support Center</h3> <p>Find help and assistance with our comprehensive support resources.</p> <ul> <li>Technical Documentation</li> <li>FAQ Section</li> <li>Live Chat Support</li> <li>Video Tutorials</li> </ul> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-resources" aria-labelledby="tab-resources" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Resources</h3> <p>Access downloadable resources and tools for developers and designers.</p> <p>Browse our collection of design assets, code snippets, and implementation guides.</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-documentation" aria-labelledby="tab-documentation" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Documentation</h3> <p>Comprehensive documentation for the National Design System components and guidelines.</p> <p>Learn how to implement and customize components according to government standards.</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-news" aria-labelledby="tab-news" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Latest News</h3> <p>Stay updated with the latest announcements and updates from the design system team.</p> <p>New component releases, feature updates, and important notices are published here.</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-feedback" aria-labelledby="tab-feedback" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Feedback</h3> <p>We value your feedback and suggestions for improving the design system.</p> <p>Submit your ideas, report issues, or share your experience with our components.</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-settings" aria-labelledby="tab-settings" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Settings</h3> <p>Configure your preferences and customize your experience with the design system.</p> <p>Adjust theme settings, language preferences, and accessibility options.</p> </div> </div> </div> </div>

With Leading Icons

Icons before each label help users scan and identify tabs quickly

Dashboard

Your main dashboard with key metrics and quick access to important features.

<div class="nds-tabs"> <div class="nds-tab-list-container nds-scroll-more"> <nav class="nds-tab-list nds-scroll-more-content" role="tablist" aria-label="Icon tab navigation"> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="true" aria-controls="panel-dashboard" id="tab-dashboard" tabindex="0" type="button"> <i class="hgi hgi-stroke hgi-home-05"></i> <span class="nds-label">Dashboard</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-analytics" id="tab-analytics" tabindex="-1" type="button"> <i class="hgi hgi-stroke hgi-analytics-01"></i> <span class="nds-label">Analytics</span> </button> <button class="nds-btn nds-subtle nds-tab" role="tab" aria-selected="false" aria-controls="panel-settings" id="tab-settings" tabindex="-1" type="button"> <i class="hgi hgi-stroke hgi-settings-01"></i> <span class="nds-label">Settings</span> </button> </nav> <button class="nds-btn nds-subtle nds-tab nds-show-more" aria-label="Show more" type="button"><i class="nds-icon nds-hgi-arrow-down-01" aria-hidden="true"></i> </button> </div> <div class="nds-tab-content"> <div class="nds-tab-panel" role="tabpanel" id="panel-dashboard" aria-labelledby="tab-dashboard" tabindex="0"> <div class="nds-block"> <h3 class="nds-block-title">Dashboard</h3> <p>Your main dashboard with key metrics and quick access to important features.</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-analytics" aria-labelledby="tab-analytics" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Analytics</h3> <p>Configure your analytics preferences and data visualization options.</p> </div> </div> <div class="nds-tab-panel" role="tabpanel" id="panel-settings" aria-labelledby="tab-settings" aria-hidden="true" tabindex="-1" hidden> <div class="nds-block"> <h3 class="nds-block-title">Settings</h3> <p>Configure your preferences and manage your account settings.</p> </div> </div> </div> </div>

Built-in Features

Auto-initialization

Activates when .nds-tabs is on the page. Tab switching, keyboard handling, and scroll behavior attach automatically.

Full Keyboard Navigation

Arrow keys move between tabs, Home and End jump to first and last, and Enter or Space activates the focused tab.

RTL-Aware Navigation

Arrow key direction reverses automatically in RTL layouts so navigation always feels natural to the reading direction.

Overflow Scrolling

Long tab lists scroll horizontally with gradient fade indicators, drag-to-scroll, mouse wheel support, and a show-more button.

Vertical Layout

Add nds-vertical for a side-stacked tab list with sticky positioning and vertical indicator bars.

High Contrast and Reduced Motion

Enhanced borders appear in high-contrast mode, and all transitions are disabled when the user prefers reduced motion.

Tab Change Events

Every tab switch dispatches an nds:tab:change event with the new and previous tab and panel references.

Programmatic Control

Switch tabs, query the active panel, or destroy instances through the JS API on NDS.Tabs or each element's .ndsTabs property.

Usage Guidelines

Best Practices

  • Use tabs to organize related content that users access one section at a time, such as settings categories, service details, or dashboard views
  • Use tabs for content that benefits from quick comparison, where switching between panels helps users evaluate options without leaving the page
  • Use vertical tabs when the tab list is long or when labels need more space, such as multi-step configuration panels or category navigation
  • Do not use tabs for sequential workflows where the user must complete steps in order. Use a Stepper instead
  • Do not use tabs for simple content that fits on one page without segmentation. Unnecessary tabs add interaction cost
  • Do not use tabs for a small set of short, equal-weight views of the same data, such as a date range or a status filter. Use a Content Switcher, which fills the current segment so the choice reads at a glance
  • Choose card view when tabs appear inside a content area that already has a background, to visually contain the tab group
  • Add the divider modifier when you need a clear visual boundary between the tab list and the panel content
  • Keep tab labels short (one to three words). Long labels cause excessive scrolling in horizontal layouts
  • Add icons to tabs when they represent distinct categories that benefit from visual differentiation, but avoid icons on text-heavy labels where they add clutter
  • Aim for three to seven visible tabs. Beyond that, the overflow scroll mechanism handles the rest, but users may not discover hidden tabs easily
  • Structure tab panel content using nds-block with nds-block-title headings. Multiple content blocks per panel create clear visual sections within a single tab
  • Place the most frequently accessed tab first, as it becomes the default active panel on page load

Modifier Classes

Class Description
nds-vertical Switches to a side-stacked vertical tab layout with sticky positioning
nds-divided Adds a divider line between the tab list and panel content
nds-center Centers the tab list horizontally within the container
nds-sm Drops the tab height to 32px and pins the label to the small type step. Tab sizing runs one rung above the button ladder: 32 / 40 / 48 against a button's 24 / 32 / 40
nds-lg Raises the tab height to 48px for a larger touch target. The unmodified default is 40px, so no class is needed for the middle step
nds-card nds-stroke nds-shadow Wraps the tab group in a card container with border and shadow
nds-loading Activates the processing skeleton: tab label bars animate and panel children hide. On .nds-tabs or .nds-tab-list. Equivalent to data-state="loading"

Data Attributes

Attribute Description
data-state="loading" Set on .nds-tabs or .nds-tab-list to activate the processing skeleton. Tab label bars animate and panel children hide until the attribute is removed. Equivalent to adding the nds-loading class
data-nds-tabs-initialized Stamped on .nds-tabs by JS after initialization. The pre-init skeleton (automatic label bars) is active on any .nds-tabs that lacks this attribute, so the strip is never visually bare before JS runs

CSS Custom Properties

Property Default Description
--scroll-fade 48px Width of the gradient fade at the edges of an overflowing tab list (set on the inner .nds-scroll-more)
--btn-indicator-size 3px Thickness of the active tab indicator bar and divider line
--tab-button-gap var(--spacing-xs) Gap between a tab's icon and its label
--tab-button-padding-block 0 Vertical padding inside each tab button. Zero by default so the tab stands exactly at its size step
--tab-button-padding-inline the button's own padding Horizontal padding inside each tab button. Falls back to the button default, so it tracks the size step: 12px at nds-sm, 16px default, 20px at nds-lg

JavaScript API

The NDS.Tabs API provides methods to create, switch, and query tab instances. Each initialized .nds-tabs element stores its instance on the .ndsTabs DOM property. The same controller drives the Content Switcher, so everything below applies to a switcher instance too.

// ── Global API ────────────────────────────────────── NDS.Tabs.init(); // Re-scan page and initialize new .nds-tabs elements NDS.Tabs.reinit(); // Alias for init(), useful after dynamic content changes NDS.Tabs.create(container); // Create and return a new NDSTabs instance for a DOM element // ── Instance API ──────────────────────────────────── // Access via element.ndsTabs const tabs = document.querySelector('#myTabs').ndsTabs; tabs.switchTo(2); // Switch to the third tab (zero-based index) tabs.getActiveTabIndex(); // Returns the current active tab index tabs.getActiveTab(); // Returns the active tab button element tabs.getActivePanel(); // Returns the active panel element tabs.destroy(); // Remove all event listeners and clean up // ── Custom Event ──────────────────────────────────── // Dispatched on the .nds-tabs container element, bubbles up document.addEventListener('nds:tab:change', (e) => { e.detail.tabIndex; // New active tab index (number) e.detail.tab; // New active tab button element e.detail.panel; // New active panel element e.detail.previousTab; // Previously active tab button element e.detail.previousPanel; // Previously active panel element });
Last Modified Date: 29/07/2026 - 09:08 PM
Was this page useful?
60% of users said Yes from 2843 Feedbacks