Option
<pc-option> Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Options define the selectable items within various form controls such as a select.
Additional demonstrations can be found in the select demos.
Eigenschaften#
| Name | Beschreibung | Reflektiert | Standard |
|---|---|---|---|
value | The option’s value. When selected, the containing form control will receive this value. The value must be unique from other options in the same group. Values must not contain spaces, as spaces are used as delimiters when listing multiple values. Typ: string |
| "" |
disabled | Disables the option, preventing selection. Typ: boolean |
| false |
updateComplete | Ein schreibgeschütztes Promise, das erfüllt ist, sobald die Komponente fertig aktualisiert wurde. | ‐ |
Erfahre mehr über Attribute und Eigenschaften.
Slots#
| Name | Beschreibung |
|---|---|
| (default) | The option’s label. |
prefix | Used to prepend an icon or similar element to the option. |
suffix | Used to append an icon or similar element to the option. |
Erfahre mehr über die Benutzung von Slots.
Methoden#
| Name | Beschreibung | Argumente |
|---|---|---|
getTextLabel() | Returns a plain text label based on the option’s content. | ‐ |
Erfahre mehr über Methoden.
Parts#
| Name | Beschreibung |
|---|---|
checked-icon | The checked icon, a <pc-icon> element. |
base | The component’s base wrapper. |
label | The option’s label. |
prefix | The container that wraps the prefix. |
suffix | The container that wraps the suffix. |
Erfahre mehr über das Anpassen von CSS‐Parts.
Importieren#
Wenn du den Autoloader oder den Standard‐Loader nutzt, kannst du diesen Abschnitt überspringen. Falls du „Cherry Picking“ betreibst, kannst du die folgenden Snippets verwenden, um diese Komponente zu importieren.
Um diese Komponente manuell vom CDN zu importieren, kopiere dieses Code‐Snippet und füge es in dein HTML ein.
<script type="module" src="https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.3/cdn/components/option/option.js"></script> Um diese Komponente manuell vom CDN zu importieren, kopiere dieses Code‐Snippet und füge es in deine JavaScript‐Datei ein.
import "https://cdn.jsdelivr.net/npm/placer-toolkit@1.0.0-alpha.3/cdn/components/option/option.js"; Um diese Komponente manuell via npm zu importieren, kopiere dieses Code‐Snippet und füge es in deine JavaScript‐Datei ein.
import "placer-toolkit/dist/components/option/option.js"; Abhängigkeiten#
Diese Komponente importiert automatisch folgende Komponenten: