Zur Navigation Zum Inhalt Kontakt Menu Komponente finden Übersicht Lyne
Prinzipien Grundlagen Barrierefreiheit Design System Guidelines Deutsch Français Italiano English Unsere Gestaltungsprinzipien Nutzerzentriert Wiedererkennbar Inklusiv Reduziert Ganzheitlich Selbsterklärend Aufgabenorientiert Passend SBB Markenportal Logo Digitale Uhr Nutzungsrechte Basis-Farben Funktionale Farben Off-Brand Farben Icons Fahrplan-Icons Piktogramme Über Barrierefreiheit Über diesen Guide Kontakt Weitere Informationen Product Owner User Research Interaction Design Visual Design Development Content Design Testing Was ist ein Design System?​ Designing Coding FAQ Hilfe Prozess Contribution Kontakt Übersicht Basis Komponenten Übersicht Releases Design Tokens Komponenten Roadmap Übersicht Basis Informationen Übersicht Basis Komponenten Sinn & Zweck Community Assets Anleitung Power-Apps Digitale Werbebanner SAP App Icons Accent-Button Info

Was macht die Komponente?

Ein Button ist ein interaktives Element, das eine Aktion auslöst, wenn er angeklickt wird.

Wann soll die Komponente eingesetzt werden?

  • Um eine primäre oder sekundäre Aktion auf einer Seite auszuführen.
  • Um das Absenden von Formularen zu ermöglichen.
  • Um Interaktionen, wie das Öffnen von Dialogen oder das Navigieren zu einer anderen Seite, zu ermöglichen.

Regeln

  • Ein Button soll klar beschriftet sein und eine eindeutige Aktion beschreiben.
Accent-Button-Link Accent-Button-Static Button Button-Link Button-Static Secondary-Button Secondary-Button-Link Secondary-Button-Static Transparent-Button Transparent-Button-Link Transparent-Button-Static Action-Group
Anatomie
Anatomie der Komponente
Nummer Typ Beschreibung Optional Hinweis
1 Komponente sbb-icon Ja Ein Icon oder ein Label ist zu setzen.
2 Text Label Ja Ein Icon oder ein Label ist zu setzen.
Demo

Spielwiese

Label
Grössen S M L Icon Ja Nein Label Ja Nein Negativ Nein Ja Hintergrund White Milk Iron Charcoal Black
Default
Negative
Disabled
Negative Disabled
Icon Only
Icon Only Negative
Icon Only Disabled
No Icon
Size M
Size S
Fixed Width
With Slotted Icon
Loading Indicator
Request Submit
With Hidden Slotted Icon
HTML in Zwischenablage kopiert.
Implementation

The sbb-accent-button component provides the same functionality as a native <button>
enhanced with the SBB Design in the 'accent' variant.

<sbb-accent-button>Button text</sbb-accent-button>

Slots

The button text is provided via an unnamed slot; the component can optionally display a sbb-icon
at the component start using the iconName property or via custom content using the icon slot.
At least one is mandatory, so you can have a sbb-accent-button with icon only, text only, or with both.

<sbb-accent-button icon-name="info"> Button text </sbb-accent-button>

<sbb-accent-button>
  <sbb-icon slot="icon" name="info"></sbb-icon>
  Button text
</sbb-accent-button>

<sbb-accent-button icon-name="info" aria-label="Click for more information."></sbb-accent-button>

Button properties

The component is internally rendered as a button,
accepting its associated properties (type, name, value and form).

<sbb-accent-button type="submit" name="tickets" form="buy" value="tickets">
  Buy tickets
</sbb-accent-button>

Style

The component has a negative variant which can be set using the negative property.

There are two different sizes (m and l, which is the default) that can be set using the size property.

The component can be displayed in disabled state using the self-named property.

<sbb-accent-button negative>Button</sbb-accent-button>

<sbb-accent-button size="m">Button</sbb-accent-button>

<sbb-accent-button disabled>Button</sbb-accent-button>

Focus outline

Please make sure that the focus outline appears in the correct color if the component is used on a dark background.
You can set it by re-defining the CSS var on sbb-accent-button or any parent element:

sbb-accent-button {
  --sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);
}

Accessibility

Use the accessibility properties in case of an icon-only button to describe the purpose of the sbb-accent-button for screen-reader users.

Interactive disabled buttons

Native disabled elements cannot receive focus and do not dispatch any events. This can
be problematic in some cases because it can prevent the app from telling the user why the button is
disabled. Consumers can use the disabledInteractive property to style the button as disabled but allow for
it to receive focus and dispatch events. The button will have aria-disabled="true" for assistive
technology. It is the consumers responsibility to provide a reason for the element being disabled.
This can be achieved by adding an aria-label, aria-labelledby or aria-describedby attribute.

Note: Using the disabledInteractive property can result in buttons that previously prevented
actions to no longer do so, for example a submit button in a form. When using this input, you should
guard against such cases in your component.

Properties

Name Attribute Privacy Type Default Description
disabled disabled public boolean false Whether the component is disabled.
disabledInteractive disabled-interactive public boolean false Whether the button should be aria-disabled but stay interactive.
form form public HTMLFormElement | null The <form> element to associate the button with.
iconName icon-name public string '' The icon name we want to use, choose from the small icon variants from the ui-icons category from here https://icons.app.sbb.ch.
name name public string Name of the form element. Will be read from name attribute.
negative negative public boolean false Negative coloring variant flag.
size size public SbbButtonSize 'l' / 's' (lean) Size variant, either l, m or s.
type type public SbbButtonType 'button' The type attribute to use for the button.
value value public string | null null Value of the form element.

Slots

Name Description
Use the unnamed slot to add content to the accent-button.
icon Slot used to display the icon, if one is set
Komponente finden

Lyne

  • Design Tokens
  • Animation
    Animation
  • Border
    Border
  • Breakpoint
    Breakpoint
  • Color
    Color
  • Layout
    Layout
  • Shadow
    Shadow
  • Size
    Size
  • Spacing
    Spacing
  • Typografie
    Typografie
  • Action
  • More Info
    Action-Group
  • More Info
    Block-Link
  • More Info
    Button
  • More Info
    Link
  • More Info
    Mini-Button-Group
  • More Info
    Secondary-Button
  • More Info
    Teaser
  • More Info
    Teaser-Hero
  • More Info
    Teaser-Product
  • More Info
    Teaser-Product-Static
  • More Info
    Accent-Button
  • More Info
    Transparent-Button
  • Brand
  • More Info
    Clock
  • More Info
    Logo
  • Collection
  • More Info
    Link-List
  • More Info
    Link-List-Anchor
  • More Info
    Paginator
  • More Info
    Compact-Paginator
  • More Info
    Skiplink-List
  • More Info
    Table-Wrapper
  • Form
  • More Info
    Autocomplete
  • More Info
    Autocomplete-Grid
  • More Info
    Calendar
  • More Info
    Checkbox
  • More Info
    Checkbox-Group
  • More Info
    Checkbox-Panel
  • More Info
    Datepicker
  • More Info
    File-Selector-Dropzone
  • More Info
    File-Selector
  • More Info
    Form-Field
  • More Info
    Radio-Button
  • More Info
    Radio-Button-Group
  • More Info
    Radio-Button-Panel
  • More Info
    Select
  • More Info
    Selection-Expansion-Panel
  • More Info
    Slider
  • More Info
    Toggle
  • More Info
    Toggle-Check
  • Indicator
  • More Info
    Alert
  • More Info
    Alert-Group
  • More Info
    Chip-Label
  • More Info
    Loading-Indicator
  • More Info
    Loading-Indicator-Circle
  • More Info
    Message
  • More Info
    Notification
  • More Info
    Status
  • More Info
    Stepper
  • More Info
    Tag-Group
  • More Info
    Toast
  • Layout
  • More Info
    Accordion
  • More Info
    Card
  • More Info
    Container
  • More Info
    Divider
  • More Info
    Footer
  • More Info
    Header
  • More Info
    Map-Container
  • More Info
    Title
  • Navigation
  • More Info
    Breadcrumb
  • More Info
    Breadcrumb-Group
  • More Info
    Menu
  • More Info
    Navigation
  • More Info
    Tab-Group
  • Overlay
  • More Info
    Dialog
  • More Info
    Overlay
  • More Info
    Popover
  • Time-Table
  • More Info
    Journey-Header
  • Visual asset
  • More Info
    Icon
  • More Info
    Image
Impressum Kontakt Datenschutz Cookie Einstellungen