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 supplémentaires 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 Releases Design Tokens Composants Aperçu Base Informations Aperçu Base Composants Aperçu Power-Apps Bandeaux publicitaires numériques SAP IA Design : Bases Icônes d’applications Cette page n'est pas disponible dans la langue souhaitée. Langues disponibles: Deutsch English Icon-Sidebar Info

Was macht die Komponente?

Die Icon-Sidebar ist eine vertikale Navigationsleiste, die zur Strukturierung von Inhalten innerhalb einer Anwendung dient. Sie ermöglicht eine schnelle und intuitive Navigation zwischen verschiedenen Bereichen oder Funktionen der Anwendung. Die Icon-Sidebar kann Links oder Buttons enthalten.

Wann soll die Komponente eingesetzt werden?

  • Wenn eine Anwendung eine permanente oder leicht zugängliche Navigation benötigt.
  • Wenn Benutzer:innen schnell zwischen mehreren Hauptbereichen wechseln müssen.

Regeln

  • Die Icon-Sidebar kann mit der Sidebar kombiniert werden. In diesem Fall soll entweder die Icon-Sidebar oder Sidebar die Farbvariante «Milk» verwenden, damit sich die zwei Komponenten visuell differenzieren lassen.
Sidebar Icon-Sidebar-Button Icon-Sidebar-Link Icon-Sidebar-Content Icon-Sidebar-Container
Anatomie

Anatomie der Komponente


Nummer Typ Beschreibung Optional Hinweis
1 Komponente sbb-icon-sidebar Nein
2 Komponente sbb-icon-sidebar-button oder sbb-icon-sidebar-link Nein
2a Komponente sbb-icon-sidebar-button oder sbb-icon-sidebar-link Nein Hover State mit Tooltip
2b Komponente sbb-icon-sidebar-button oder sbb-icon-sidebar-link Nein Current State
3 Komponente sbb-sidebar-title Ja
4 Komponente sbb-sidebar-close-button Ja
5 Inhalt Nein
6 Eigenschaft Backdrop Ja Nur im Overlay-Mode sichtbar
Demo Default
Milk
Milk End
Nested
Nested End
HTML in Zwischenablage kopiert.
Implementation

The <sbb-icon-sidebar> is a component that can display action items with an icon on the left or right side of the viewport.

The icon sidebar components are designed to add side content to a fullscreen app.
To set up an icon sidebar we use three components: <sbb-icon-sidebar-container> which acts as a structural container for
our content and sidebar, <sbb-icon-sidebar-content> which represents the main content,
and <sbb-icon-sidebar> which represents the added side content.

<sbb-icon-sidebar-container>
  <sbb-icon-sidebar>
    <sbb-icon-sidebar-link
      sbb-tooltip="Go to the party"
      accessibility-label="Go to the party"
      icon-name="glass-cocktail-small"
      href="#"
    ></sbb-icon-sidebar-link>
    <sbb-icon-sidebar-link
      sbb-tooltip="Be a unicorn"
      accessibility-label="Be a unicorn"
      icon-name="unicorn-small"
      href="#"
      class="sbb-active"
      accessibility-current="page"
    ></sbb-icon-sidebar-link>
  </sbb-icon-sidebar>
  <sbb-icon-sidebar-content role="main">
    <p style="padding: var(--sbb-spacing-fixed-4x); margin: 0">
      In the enchanting world of fantasy, unicorns are legendary creatures known for their grace,
      purity, and magical abilities. These mystical beings have inspired countless tales of bravery
      and wonder. Here, we delve into some captivating unicorn success stories that continue to
      enchant and inspire, each with a touch of public transport magic.
    </p>
  </sbb-icon-sidebar-content>
</sbb-icon-sidebar-container>

Color

Per default, the <sbb-icon-sidebar> receives a white background color. As alternative,
it's possible to set the color property to milk.
If using the <sbb-icon-sidebar> along with a <sbb-sidebar>, it's recommended to alternate
the background colors (white / milk) for a clear visual distinction.

<sbb-icon-sidebar color="milk"></sbb-icon-sidebar>

Position

An <sbb-icon-sidebar> can be positioned at the left or right side of the viewport.
To display the icon sidebar on the right side, place the <sbb-icon-sidebar>
after the <sbb-icon-sidebar-content> in the DOM.
Technically it's possible to place two icon sidebars, but from UX perspective it's not recommended.

positioned on the right side:

<sbb-icon-sidebar-container>
  <sbb-icon-sidebar-content role="main">Content</sbb-icon-sidebar-content>
  <sbb-icon-sidebar>Sidebar Content</sbb-icon-sidebar>
</sbb-icon-sidebar-container>

Accessibility

The <sbb-icon-sidebar> has the role navigation applied.

The <sbb-sidebar-content> should be given a role based on what it contains. If it
represents the primary content of the page, it may make sense to mark it role="main". If no more
specific role makes sense, role="region" is a good fallback.

As described in sbb-icon-sidebar-link and
sbb-icon-sidebar-button, it's important to set
both a label and a tooltip to the action elements.
It's also described how to set the current icon as active (aria-current).

Combine with sbb-sidebar

It's possible the combine the <sbb-icon-sidebar> with the <sbb-sidebar> as following:

<sbb-icon-sidebar-container>
  <sbb-icon-sidebar>Icon sidebar content</sbb-icon-sidebar>
  <sbb-icon-sidebar-content>
    <sbb-sidebar-container>
      <sbb-sidebar role="navigation">Sidebar content</sbb-sidebar>
      <sbb-sidebar-content role="main">Content</sbb-sidebar-content>
    </sbb-sidebar-container>
  </sbb-icon-sidebar-content>
</sbb-icon-sidebar-container>

Use with sbb-header

Check sbb-icon-sidebar-container on how to
position and connect the sbb-header with the icon sidebar.

Properties

Name Attribute Privacy Type Default Description
color color public 'white' | 'milk' 'white' Background color of the icon sidebar. Either white or milk. *
container - public SbbIconSidebarContainerElement | null Returns the SbbIconSidebarContainerElement where this icon-sidebar is contained.

Slots

Name Description
Use the unnamed slot to slot any content into the icon-sidebar.