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 Calendar Info

Was macht die Komponente?

Ein Kalender ist eine Komponente, die es Nutzenden ermöglicht, Datumsinformationen anzuzeigen und auszuwählen.

Wann soll die Komponente eingesetzt werden?

  • Um Nutzenden eine einfache Möglichkeit zu bieten, Datumsabhänige Informationen wie z.B. Termine zu sehen und zu verwalten.
  • Um die Auswahl von Datumsbereichen für Buchungen oder Planungen zu ermöglichen.
  • Um wiederkehrende Ereignisse und deren Muster darzustellen.

Regeln

  • Es können einzelne Monate oder ganze Jahre dargestellt werden.
  • Wird der Kalender im Date-Picker eingesetzt, kann nur ein Datum gewählt werden.
  • Wird der Kalender Standalone eingesetzt, so können mehrere Daten gewählt werden.
  • Einzelne Tage können mehrere Stati haben.
Datepicker
Anatomie
Anatomie der Komponente
Nummer Typ Beschreibung Optional Hinweis
1a Tag, Monat, Jahr, gewählt Nein
1b Tag, Monat, Jahr, default Nein
1b Tag, Monat, Jahr, disabled Ja
2 Wochentage Nein
3 Monat/Jahr/Jahre (inkl. Switcher) Nein
4 Vorheriger Monat Ja
5 Nächster Monat Ja
Demo

Spielwiese

Wide Nein Ja Hintergrund White Milk Iron Charcoal Black
Calendar
Calendar With Min And Max
Calendar Wide
Calendar Filter Function
Calendar With Initial Year Selection
HTML in Zwischenablage kopiert.
Implementation

The sbb-calendar component displays a calendar that allows the user to select a date.

While being deeply linked to the implementation of the sbb-datepicker-toggle component,
it can be used on its own.

<sbb-calendar></sbb-calendar>

It's possible to set a date using the dateSelected property. Also, it's possible to place limits on the selection
using the two properties named min and max. For these three properties, the accepted formats are:

  • Date objects
  • ISO String
  • Unix Timestamp (number of seconds since Jan 1, 1970)

It's recommended to set the time to 00:00:00.

<sbb-calendar min="1600000000" max="1700000000" selected="1650000000"></sbb-calendar>

To simulate the current date, you can use the now property,
which accepts a Date or a timestamp in seconds (as number or string).
This is helpful if you need a specific state of the component.

Style

The component displays one month by default; two months can be displayed setting the wide property to true.

<sbb-calendar wide="true" selected="1650000000"></sbb-calendar>

It's also possible to filter out unwanted date using the dateFilter function property.
Note that using the dateFilter function as a replacement for the min and max properties will most likely result in a significant loss of performance.

Events

Consumers can listen to the dateSelected event on the sbb-calendar component to intercept the selected date
which can be read from event.detail.

Keyboard interaction

It's possible to move within the component using the keyboard.

Keyboard Action
Left Arrow Go to previous day.
Right Arrow Go to next day.
Up Arrow Go to the same day in the previous week.
Down Arrow Go to the same day in the next week.
Home Go to the first day of the month.
End Go to the last day of the month.
Page Up Go to the top of the column of the currently selected day.
Page Down Go to the bottom of the column of the currently selected day.

Accessibility

For accessibility purposes, the component is rendered as a native table element and each day is a button.

Properties

Name Attribute Privacy Type Default Description
dateFilter date-filter public ((date: T | null) => boolean) | null null A function used to filter out dates.
max max public T | null The maximum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970).
min min public T | null The minimum valid date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970).
now now public T null A configured date which acts as the current date instead of the real current date. Recommended for testing purposes.
selected selected public T | null The selected date. Takes T Object, ISOString, and Unix Timestamp (number of seconds since Jan 1, 1970).
view view public CalendarView 'day' The initial view of the calendar which should be displayed on opening.
wide wide public boolean false If set to true, two months are displayed

Methods

Name Privacy Description Parameters Return Inherited From
resetPosition public Resets the active month according to the new state of the calendar. void

Events

Name Type Description Inherited From
dateSelected CustomEvent<T> Event emitted on date selection.
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
    Teasser-Hero
  • More Info
    Teaser-Product
  • More Info
    Teaser-Product-Static
  • More Info
    Tertiary-Button
  • More Info
    Transparent-Button
  • Brand
  • More Info
    Clock
  • More Info
    Logo
  • Collection
  • More Info
    Link-List
  • More Info
    Link-List-Anchor
  • 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
  • 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
  • More Info
    Loading-Indicator
  • 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
    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
  • More Info
    Pearl-Chain
  • Visual asset
  • More Info
    Icon
  • More Info
    Image
Impressum Kontakt Datenschutz Cookie Einstellungen