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 What is a design system? Designing Coding FAQ Aiuto Processo Contribution Contatto Introduzione Base Componenti Introduzione Base Componenti Introduzione Base Componenti Introduzione Design Tokens Componenti Introduzione Base Informazioni Senso & scopo Community Assets Istruzioni Power-Apps Banner pubblicitari digitali SAP Icone delle app
Trova un componente

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

Questa pagina non è disponibile nella lingua desiderata. Lingue disponibili: 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>

Slots

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.

NOTE:

  • 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>

<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>
<sbb-button>Confirm</sbb-button>
</sbb-action-group>
</sbb-dialog>

Interactions

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>
</sbb-dialog>

<script>
const openDialog = (event, id) => {
const dialog = document.getElementById(id);
dialog.open(event);
};
</script>

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.

Style

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.

Properties

Name Attribute Privacy Type Default Description
titleContent title-content public string 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.

Methods

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

Events

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

Slots

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.
Demo
mit Action-Groupohne Action-Groupohne Action-Group, Fullscreen

Dialog content

LinkCancelConfirm

Dialog content

Dialog content

Negativ Nein Ja Back-Button Nein Ja Hintergrund White Milk Iron Charcoal Black Mehr Beispiele auf Storybook
Impressum Contatto Impostazioni dei cookie