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.
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;variantpicks 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
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
appearance | appearance | Tab style: ‘underline’ (text tabs with an indicator, default) or ‘segmented’ (pill-shaped segmented control; variant picks its track). | "segmented" | "underline" | 'underline' |
identifier | id | The Tabs identifier | string | undefined |
navAriaLabel | nav-aria-label | Aria label for the navigation | string | 'Tabs' |
tabs | tabs | JSON string for tabs data | string | { label: string; url?: string; active?: boolean; ariaLabel?: string; }[] | undefined |
variant | variant | Visual variant: ‘default’ for dark backgrounds, ‘inverse’ for light backgrounds | "default" | "inverse" | 'default' |
Events
| Event | Description | Type |
|---|---|---|
tab | CustomEvent<{ tabId: string; index: number; name?: string; }> |
Built with StencilJS