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

Implementation

The sbb-option is a component which can be used to display items in components like
sbb-autocomplete or a sbb-select.

Slots

It is possible to provide a label 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.
Icon space can be reserved even if the iconName property is not set by overriding the --sbb-option-icon-container-display variable.

<sbb-option>Option label</sbb-option>

<sbb-option icon-name="info">Option label</sbb-option>

States

Like the native option, the component has a value property.

The selected, disabled and active properties are connected to the self-named states.
When disabled, the selection via click is prevented.
If the sbb-option is nested in a sbb-optgroup component, it inherits from the parent the disabled state.

<sbb-option value="value" selected>Option label</sbb-option>

<sbb-option value="value" active>Option label</sbb-option>

<sbb-option value="value" ß disabled>Option label</sbb-option>

Events

Consumers can listen to the optionSelected event on the sbb-option component to intercept the selected value;
the event is triggered if the element has been selected by some user interaction. Alternatively,
the selectionChange event can be listened to, which is triggered if the element has been both selected or deselected.

Style

If the label slot contains only a text node, it is possible to search for text in the sbb-option using the
highlight method, passing the desired text; if the text is present it will be highlighted in bold.

<!-- Supported scenario -->
<sbb-option> Highlightable caption</sbb-option>

<!-- Not supported scenarios -->
<sbb-option>
<span>Not highlightable caption</span>
</sbb-option>

<sbb-option>
<img src="..." />
Highlightable caption
</sbb-option>

Properties

Name Attribute Privacy Type Default Description
value value public string | undefined Value of the option.
iconName icon-name public string | undefined 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.
active active public boolean | undefined Whether the option is currently active.
selected selected public boolean false Whether the option is selected.
disabled disabled public boolean | undefined Whether the option is disabled.

Methods

Name Privacy Description Parameters Return Inherited From
setGroupLabel public Set the option group label (used for a11y) value: string void

Events

Name Type Description Inherited From
optionSelectionChange CustomEvent<void> Emits when the option selection status changes.
optionSelected CustomEvent<void> Emits when an option was selected by user.

Slots

Name Description
Use the unnamed slot to add content to the option label.
icon Use this slot to provide an icon. If icon-name is set, a sbb-icon will be used.
Demo
Value 1Value 2Value 3Value 4Value 5
Disabled Nein Ja Icon Ja Nein Hintergrund White Milk Iron Charcoal Black Mehr Beispiele auf Storybook
Impressum Contatto Impostazioni dei cookie