eds-tabs

Explore the Interactive Component

Use the playground below to experiment with the component. Click the button to view the full Storybook deployment for additional examples and configurations.

eds-tabs Open in Storybook

See It in Use with Code

Check out the practical implementations of component.

Passing Links as a JSON String (Plain HTML)

When you’re using the component directly in HTML (or in frameworks that don’t support property binding), you must pass the links as a JSON string:

Here the tabs attribute is a string; the component parses it into an array of objects.

Passing Links as an Object (Using Property Binding)

In frameworks like React or Angular, you can take advantage of property binding to pass the links directly as an object:

In React

Example with Slot Content

Each tab renders a named slot panel-N, where N is the zero-based index of the tab in tabs (panel-0, panel-1, …). Only the panel of the active tab is shown.

Example with Dynamic Content Rendering

There are two parts:

Let’s add some javascript logic to interact with the tabs component

Create a new tabs.js file and store it in your application.

Complete React Example

Overview

EdsTabs switches between related panels of content.

Key features:

  • appearance="underline" (default): text tabs on a fine rule with an accent indicator under the active tab — the quiet, brand default.
  • appearance="segmented": a pill-shaped segmented control; variant picks a dark (default) or light (inverse) track.
  • Dark theme via the semantic tokens ([data-eds-theme=“dark”]).
  • Smooth hover and active state transitions
  • Keyboard navigation support (Arrow keys, Home, End)
  • Analytics tracking integration
  • Accessible with proper ARIA attributes

Properties

PropertyAttributeDescriptionTypeDefault
appearanceappearanceTab style: ‘underline’ (text tabs with an indicator, default) or ‘segmented’ (pill-shaped segmented control; variant picks its track)."segmented" | "underline"'underline'
identifieridThe Tabs identifierstringundefined
navAriaLabelnav-aria-labelAria label for the navigationstring'Tabs'
tabstabsJSON string for tabs datastring | { label: string; url?: string; active?: boolean; ariaLabel?: string; }[]undefined
variantvariantVisual variant: ‘default’ for dark backgrounds, ‘inverse’ for light backgrounds"default" | "inverse"'default'

Events

EventDescriptionType
tabCustomEvent<{ tabId: string; index: number; name?: string; }>

Built with StencilJS