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 Releases Aperçu Base Informations Sens & objectif Community Assets Instructions Power-Apps Bandeaux publicitaires numériques SAP Icônes d’applications
Trouver un composant


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 Tooltip Tooltip Tooltip-Trigger Tooltip-Trigger 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
Cette page n'est pas disponible dans la langue souhaitée. Langues disponibles Deutsch English Dialog Implementation

The sbb-dialog component provides a way to present content on top of the app's content.
It offers the following features:

  • creates a backdrop for disabling interaction below the modal;
  • disables scrolling of the page content while open;
  • manages focus properly by setting it on the first focusable element;
  • can have a header and a footer, both of which are optional;
  • can host a sbb-action-group component in the footer;
  • has a close button, which is always visible;
  • can display a back button next to the title;
  • adds the appropriate ARIA roles automatically.
<sbb-dialog> Dialog content. </sbb-dialog>


The content is projected in an unnamed slot, while the dialog's title can be provided via the titleContent property or via slot name="title".
It's also possible to display buttons in the component's footer using the action-group slot with the sbb-action-group component.


  • The component will automatically set size m on slotted sbb-action-group;
  • If the title is not present, the footer will not be displayed even if provided;
  • If the title is not present, the dialog will be displayed in fullscreen mode with the close button in the content section along with the back button
    (if visible, see next paragraph).
<sbb-dialog title-content="Title"> Dialog content. </sbb-dialog>

  <span slot="title"> My dialog title </span>
  Dialog content.
  <sbb-action-group slot="action-group">
    <sbb-button sbb-dialog-close>Abort</sbb-button>


In order to show the dialog, you need to call the open(event?: PointerEvent) method on the sbb-dialog component.
It is necessary to pass the event object to the open() method to allow the dialog to detect
whether it has been opened by click or keyboard, so that the focus can be better handled.

<sbb-button label="Open dialog" click="openDialog(event, 'my-dialog')"></sbb-button>
<sbb-dialog id="my-dialog" title-content="Title" title-back-button="true">
  Dialog content.
  <div slot="action-group">...</div>

  const openDialog = (event, id) => {
    const dialog = document.getElementById(id);

To dismiss the dialog, you need to get a reference to the sbb-dialog element and call
the close(result?: any, target?: HTMLElement) method, which will close the dialog element and
emit a close event with an optional result as a payload.

The component can also be dismissed by clicking on the close button, clicking on the backdrop, pressing the Esc key,
or, if an element within the sbb-dialog has the sbb-dialog-close attribute, by clicking on it.

You can also set the property titleBackButton to display the back button in the title section
(or content section, if title is omitted) which will emit the event requestBackAction when clicked.


It's possible to display the component in negative variant using the self-named property.

The default z-index of the component is set to 1000; to specify a custom stack order, the
z-index can be changed by defining the CSS variable --sbb-dialog-z-index.


Name Attribute Privacy Type Default Description
titleContent title-content public string | undefined Dialog title.
titleLevel title-level public TitleLevel '1' Level of title, will be rendered as heading tag (e.g. h1). Defaults to level 1.
titleBackButton title-back-button public boolean false Whether a back button is displayed next to the title.
backdropAction backdrop-action public 'close' | 'none' 'close' Backdrop click action.
negative negative public boolean false Negative coloring variant flag.
accessibilityLabel accessibility-label public string | undefined This will be forwarded as aria-label to the relevant nested element.
accessibilityCloseLabel accessibility-close-label public | string | undefined This will be forwarded as aria-label to the close button element.
accessibilityBackLabel accessibility-back-label public | string | undefined This will be forwarded as aria-label to the back button element.
disableAnimation disable-animation public boolean false Whether the animation is enabled.


Name Privacy Description Parameters Return Inherited From
open public Opens the dialog element. void
close public Closes the dialog element. result: any, target: HTMLElement any


Name Type Description Inherited From
willOpen CustomEvent<void> Emits whenever the sbb-dialog starts the opening transition. Can be canceled.
didOpen CustomEvent<void> Emits whenever the sbb-dialog is opened.
willClose CustomEvent<void> Emits whenever the sbb-dialog begins the closing transition. Can be canceled.
didClose CustomEvent<void> Emits whenever the sbb-dialog is closed.
requestBackAction CustomEvent<void> Emits whenever the back button is clicked.


Name Description
Use the unnamed slot to add content to the sbb-dialog.
title Use this slot to provide a title.
action-group Use this slot to display a sbb-action-group in the footer.
mit Action-Groupohne Action-Groupohne Action-Group, Fullscreen

Dialog content


Dialog content

Dialog content

Negativ Nein Ja Back-Button Nein Ja Hintergrund White Milk Iron Charcoal Black
Beispiele Default
Allow Backdrop Click
Slotted Title
Long Content
No Footer
Full Screen
HTML-Markup kopiert.
Impressum Contact Paramètres des cookies