Zur Navigation Zum Inhalt Kontakt Menu Trova un componente Descrizione generale Lyne Principi Base Accessibilité Sistema di design Guidelines Deutsch Français Italiano English I nostri principi di design Soluzioni focalizzate sull’utente Riconoscibilità Inclusione Riduzione Olistico Autoesplicativo Orientamento all’attività Adeguatezza Portale della marca FFS Logo Orologio digitale Diritti di utilizzazione Colori die base Colori funzionali Colori Off Brand Icone Icone dell'orario Pittogrammi Informazioni sull’accessibilità Über diesen Guide Contatti Letture consigliate Product Owner User Research Interaction Design Visual Design Development Content Design Testing Introduzione Base Componenti Senso & scopo Community Assets Istruzioni What is a design system? Designing Coding FAQ Aiuto Processo Contribution Contatto Introduzione Base Componenti Overview Releases Design Tokens Komponenten Introduzione Base Informazioni Power-Apps Banner pubblicitari digitali SAP Icone delle app Questa pagina non è disponibile nella lingua desiderata. Lingue disponibili Deutsch English Tab-Group Info

Was macht die Komponente?

Eine Tab-Group ermöglicht es Nutzenden, zwischen verschiedenen Inhalten oder Ansichten innerhalb derselben Seite zu wechseln, ohne die Seite neu zu laden.

Wann soll die Komponente eingesetzt werden?

  • Um Inhalte thematisch zu gruppieren und strukturiert darzustellen.
  • Um eine einfache und intuitive Navigation zwischen verschiedenen Inhalten oder Ansichten zu ermöglichen.
  • Um Platz auf der Benutzeroberfläche zu sparen, indem nur ein Teil des Inhalts gleichzeitig angezeigt wird.

Regeln

  • Tabs sollen klar beschriftet und leicht verständlich sein.
  • Die Reihenfolge und Beschriftung der Tabs sollen logisch und intuitiv sein.
  • Vermeide zu viele Tabs auf einmal, um die Übersichtlichkeit zu gewährleisten und die Benutzer nicht zu überfordern.

Enthaltene Komponenten

Anatomie
Anatomie der Komponente
Nummer Typ Beschreibung Optional Hinweis
1a Komponente sbb-tab-label Nein Aktiver Zustand
1b Komponente sbb-tab-label Nein Default Zustand
2 Komponente sbb-tab Nein
Demo

Beispiele

Default Tabs Size L
Numbers And Icons Size L
Default Tabs Size XL
Numbers And Icons Size XL
Default Tabs Size S
Numbers And Icons Size S
Nested Tab Groups
Tinted Background
HTML-Markup kopiert.
Implementation

The sbb-tab-group is a component used to organize and gather tabs that the user can navigate through;
use it when you want to provide navigation within blocks of content, instead of showing everything in one place
or requiring the user to navigate between several different views.

Each tab has a related content, distinct from other tabs' content;
tab panels can present different sections of content and include text, images, forms, other tab groups, etc.

<sbb-tab-group>
  <sbb-tab-label>I am the first</sbb-tab-label>
  <sbb-tab> Tab content 1 </sbb-tab>

  <sbb-tab-label>I am the second</sbb-tab-label>
  <sbb-tab> Tab content 2 </sbb-tab>

  <sbb-tab-label>I am the third</sbb-tab-label>
  <sbb-tab> Tab content 3 </sbb-tab>
</sbb-tab-group>

To display a tab label within the tab bar, provide a sbb-tab-label right before its related tab content;
please refer to the sbb-tab-label documentation for more details.

The content element must be wrapped in a sbb-tab and placed right after its relative sbb-tab-label.
Tab groups can also be nested, which means that a sbb-tab can contain another sbb-tab-group,
as shown in the "Nested Tab Groups" example.

States

A tab can be selected, unselected, or in disabled state; disable a tab to mark it as unavailable.
Disabled tabs cannot be focused and may be invisible to assistive technologies such as screen readers.

It's possible to set the first selected tab using the initialSelectedIndex property.

<sbb-tab-group initial-selected-index="1"> ... </sbb-tab-group>

Events

Consumers can listen to the didChange event, whose event.detail is typed as SbbTabChangedEventDetails.
From it, it's possible to retrieve the information about the current sbb-tab-label, sbb-tab and index, and,
if available, also the information about the previous ones.

type SbbTabChangedEventDetails = {
  activeIndex: number;
  activeTabLabel: SbbTabLabelElement;
  activeTab: SbbTabElement;
  previousIndex: number;
  previousTabLabel: SbbTabLabelElement | undefined;
  previousTab: SbbTabElement | undefined;
};

Properties

Name Attribute Privacy Type Default Description
initialSelectedIndex initial-selected-index public number 0 Sets the initial tab. If it matches a disabled tab or exceeds the length of the tab group, the first enabled tab will be selected.
size size public InterfaceSbbTabGroupTab['size'] 'l' Size variant, either s, l or xl.

Methods

Name Privacy Description Parameters Return Inherited From
activateTab public Activates a tab by index. tabIndex: number void
disableTab public Disables a tab by index. tabIndex: number void
enableTab public Enables a tab by index. tabIndex: number void

Events

Name Type Description Inherited From
didChange CustomEvent<SbbTabChangedEventDetails> Emits an event on selected tab change.

Slots

Name Description
Use the unnamed slot to add content to the sbb-tab-group via sbb-tab-label and sbb-tab instances.
Impressum Contatto Impostazioni dei cookie