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 Overview Releases Design Tokens Composants Roadmap Aperçu Base Informations Aperçu Base Composants Sens & objectif Community Assets Instructions Power-Apps Bandeaux publicitaires numériques SAP Icônes d’applications Slider Info

Was macht die Komponente?

Ein Slider ermöglicht es Nutzenden, einen Wert oder eine Auswahl innerhalb eines festgelegten Bereichs durch Ziehen eines Schiebereglers einzustellen.

Wann soll die Komponente eingesetzt werden?

  • Um Nutzenden eine einfache und intuitive Möglichkeit zur Einstellung von Werten innerhalb eines bestimmten Bereichs zu bieten.
  • Wenn eine präzise oder schnelle Anpassung eines Wertes erforderlich ist.
  • Um Platz auf der Benutzeroberfläche zu sparen, indem ein interaktives Steuerelement verwendet wird.

Regeln

  • Verwende Beschriftungen und Icons, um den Wertebereich des Sliders deutlich zu machen.
  • Der Slider soll nur für einfache Wertebereiche (von/bis, schnell/langsam, schwer/leicht) verwendet werden.
  • Der Slider soll nicht als Fortschrittsanzeige eines Prozesses oder Vorgangs eingesetzt werden.
  • Der Slider soll eine visuelle Rückmeldung geben, wenn der Wert geändert wird, z.B. durch Anzeigen des aktuellen Wertes neben dem Slider.
Anatomie
Anatomie der Komponente
Nummer Typ Beschreibung Optional Hinweis
1 Komponente sbb-icon Ja Prefix
2 Komponente Slider Nein
1 Komponente sbb-icon Ja Suffix
Demo

Spielwiese

Read only Nein Ja Prefix Ja Nein Suffix Ja Nein Hintergrund White Milk Iron Charcoal Black
Default
With Change Event
No Icons
With Slotted Icons
Disabled
Readonly
In Form Field
In Form Field No Icons
In Form Field Disabled
HTML in Zwischenablage kopiert.
Implementation

The sbb-slider is an input component that allows for the selection of a value within a range.

This can be set using the min and max properties (default values are 0 and 100),
while the initial value can be set using the value property (string), or the valueAsNumber (number).
If no value is provided, by default it is set halfway between the minimum and maximum.

<sbb-slider max="5" min="1"></sbb-slider>

<sbb-slider value="0"></sbb-slider>

In sbb-form-field

The component can be used within a sbb-form-field component.

<sbb-form-field>
  <label>Slider</label>
  <sbb-slider value="0"></sbb-slider>
</sbb-form-field>

Slots

The component can optionally display two sbb-icons at either end;
consumers could set one/both of them using the startIcon and endIcon properties,
or can provide their own using the two slots named prefix and suffix.

<sbb-slider start-icon="circle-minus-small" end-icon="circle-plus-small"></sbb-slider>

<sbb-slider>
  <sbb-icon slot="prefix" name="battery-level-empty-small"></sbb-icon>
  <sbb-icon slot="suffix" name="battery-level-high-small"></sbb-icon>
</sbb-slider>

States

It is possible to display the component in disabled or readonly state by using the self-named properties.

<sbb-slider disabled></sbb-slider>

<sbb-slider readonly></sbb-slider>

Events

Consumers can listen to the native change event on the sbb-slider component to intercept the input's change event;
the current value can be read from event.target.value or event.target.valueAsNumber.

Keyboard interaction

The sbb-slider has the following behaviour on keypress when focused:

Key Action
Right arrow Increment the slider value by one (or one step).
Up arrow Increment the slider value by one (or one step).
Left arrow Decrement the slider value by one (or one step).
Down arrow Decrement the slider value by one (or one step).
Page up Increment the slider value by ten (or ten steps).
Page down Decrement the slider value by ten (or ten steps).
End Set the value to the maximum.
Home Set the value to the minimum.

Properties

Name Attribute Privacy Type Default Description
disabled disabled public boolean false Whether the component is disabled.
endIcon end-icon public string '' Name of the icon at component's end, which will be forward to the nested sbb-icon.
form - public HTMLFormElement | null Returns the form owner of the internals of the target element.
max max public string '100' Maximum acceptable value for the inner HTMLInputElement.
min min public string '0' Minimum acceptable value for the inner HTMLInputElement.
name name public string Name of the form element. Will be read from name attribute.
readonly readonly public boolean false Readonly state for the inner HTMLInputElement. Since the input range does not allow this attribute, it will be merged with the disabled one.
startIcon start-icon public string '' Name of the icon at component's start, which will be forward to the nested sbb-icon.
type - public string 'range' Form type of element.
value value public string | null null Value of the form element. If no value is provided, default is the middle point between min and max.
valueAsNumber value-as-number public number | null Numeric value for the inner HTMLInputElement.

Events

Name Type Description Inherited From
didChange CustomEvent<void> Deprecated. used for React. Will probably be removed once React 19 is available.

Slots

Name Description
prefix Use this slot to render an icon on the left side of the input.
suffix Use this slot to render an icon on the right side of the input.
Trouver un composant

Lyne

  • Design Tokens
  • Animation
    Animation
  • Border
    Border
  • Breakpoint
    Breakpoint
  • Color
    Color
  • Layout
    Layout
  • Shadow
    Shadow
  • Size
    Size
  • Spacing
    Spacing
  • Typography
    Typography
  • 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 Contact Protection des données Paramètres des cookies