Zur Navigation Zum Inhalt Kontakt Menu Trouver un composant Aperçu Lyne Principes Bases Accessibilité Système de design Guidelines Deutsch Français Italiano English Nos principes de design Centré sur l’utilisateur Reconnaissable Inclusif Minimaliste Holistique Auto-explicatif Axé sur les tâches Approprié Portail de la marque CFF Logo Horloge numérique Droits d’utilisation Couleurs de base Couleurs fonctionnelles Couleurs off-brand Icônes Icônes de l’horaire Pictogrammes À propos de l’accessibilité À propos de ce guide Contact Informations complémentaires Product Owner User Research Interaction Design Visual Design Development Content Design Testing What is a design system? Conception Développer FAQ Aide Procès Contribution Contact Aperçu Base Composants Aperçu Base Composants Aperçu Base Composants Aperçu Design Tokens Composants Aperçu Base Informations Sens & objectif Community Assets Instructions Power-Apps Bandeaux publicitaires numériques SAP Icônes d’applications
Trouver un composant

Lyne

Basics Animation

Animation

Border

Border

Grid

Grid

Spacings

Spacings

Typografie

Typografie

Components Action-Group

Action-Group

Alert

Alert

Alert-Group

Alert-Group

Autocomplete

Autocomplete

Button

Button

Calendar

Calendar

Card

Card

Card-Badge

Card-Badge

Checkbox

Checkbox

Checkbox-Group

Checkbox-Group

Chip

Chip

Clock

Clock

Datepicker

Datepicker

Dialog

Dialog

Divider

Divider

Footer

Footer

Form-Error

Form-Error

Form-Field

Form-Field

Header

Header

Header-Action

Header-Action

Icon

Icon

Image

Image

Journey-Header

Journey-Header

Link

Link

Link-List

Link-List

Logo

Logo

Menu

Menu

Menu-Action

Menu-Action

Radio-Button

Radio-Button

Radio-Button-Group

Radio-Button-Group

Selection-Panel

Selection-Panel

Signet

Signet

Slider

Slider

Tab-Group

Tab-Group

Tab Title

Tab Title

Tag

Tag

Tag-Group

Tag-Group

Teaser

Teaser

Teaser-Hero

Teaser-Hero

Time-Input

Time-Input

Title

Title

Toggle

Toggle

Toggle-Check

Toggle-Check

Tooltip

Tooltip

Tooltip-Trigger

Tooltip-Trigger

Cette page n'est pas disponible dans la langue souhaitée. Langues disponibles: Deutsch English

Tag-Group Implementation

The <sbb-tag-group> component is used as a container for one or multiple <sbb-tag> components,
which are projected inside the unnamed slot.

To work properly, it's mandatory to provide a value to each <sbb-tag>.

Exclusive selection vs. multiple selection

By default, <sbb-tag-group> acts like a radio-button group: only one item can be selected.
In this mode, the value of the <sbb-tag-group> will reflect the value of the selected <sbb-tag>.

Setting multiple property to true allows multiple items to be selected (checkbox behavior).
In this mode the value of the <sbb-tag-group> is an array containing all values of the selected <sbb-tag> items.

Changing multiple property during run time

There is no support for changing multiple mode during run time (e.g. update value automatically).
So this flag should be provided at component's instantiation time.

Accessibility

The property listAccessibilityLabel is forwarded as aria-label to the inner list that the component uses to display the tags, to use the implicit role="list" of the <ul>.
In case the listAccessibilityLabel property is not defined, the <sbb-tag-group> surrounding the buttons applies role="group" to convey the association between the individual <sbb-tag>s. When using the role="group", each <sbb-tag-group> element should be given a label with aria-label or aria-labelledby that communicates the collective meaning of all <sbb-tag>s.
For example, if you have toggles for "Bold", "Italic", and "Underline", you might label the parent group "Font styles".

Usage

Basic usage exclusive:

<sbb-tag-group aria-label="Select your desired device to filter it">
<sbb-tag value="all" checked>All</sbb-tag>
<sbb-tag value="phones" disabled>Phones</sbb-tag>
<sbb-tag value="computer">Computer</sbb-tag>
<sbb-tag value="laptop">Laptop</sbb-tag>
</sbb-tag-group>

Basic usage multiple:

<sbb-tag-group aria-label="Select your desired device to filter it" multiple>
<sbb-tag value="all" checked>All</sbb-tag>
<sbb-tag value="phones" disabled>Phones</sbb-tag>
<sbb-tag value="computer">Computer</sbb-tag>
<sbb-tag value="laptop">Laptop</sbb-tag>
</sbb-tag-group>

Advanced usage multiple and exclusive mixed:

const uncheckAllTag = () => {
document.getElementById('all').removeAttribute('checked');
};

const uncheckTags = () => {
Array.from(document.querySelectorAll('sbb-tag'))
.filter((e) => e.getAttribute('id') !== 'all' && !e.getAttribute('disabled'))
.forEach((e) => e.removeAttribute('checked'));
};
<sbb-tag-group aria-label="Select your desired device to filter it" multiple>
<sbb-tag id="all" onChange={() => uncheckTags()} value="All" checked>
All
</sbb-tag>
<sbb-tag value="phones" onChange={() => uncheckAllTag()}>Phones</sbb-tag>
<sbb-tag value="computer" onChange={() => uncheckAllTag()}>Computer</sbb-tag>
<sbb-tag value="laptop" onChange={() => uncheckAllTag()}>Laptop</sbb-tag>
</sbb-tag-group>

Properties

Property Attribute Description Type Default
listAccessibilityLabel list-accessibility-label This will be forwarded as aria-label to the inner list. string undefined
multiple multiple If set multiple to false, the selection is exclusive and the value is a string (or null). If set multiple to true, the selection can have multiple values and therefore value is an array. Changing multiple during run time is not supported. boolean false
value value Value of the sbb-tag-group. If set multiple to false, the value is a string (or null). If set multiple to true, the value is an array. string | string[] null

Slots

Slot Description
"unnamed" Provide one or more 'sbb-tag' to add to the group.

Demo
Label 1Label 2Label 3
Ja Nein
White Milk Iron Charcoal Black
Mehr Beispiele auf Storybook
Impressum Contact Paramètres des cookies