Dropdown-Menü
Auslöser-Button mit Aktionsmenü — Outside-Click und Escape schließen, select als semantisches Event; v1.2 (opt-in): Link-Einträge (href), Icon am Auslöser, Menü-Kopfzeile (z. B. Konto-Menü); v1.3: optionaler Icon-Button und Tastaturnavigation; zusaetzlich opt-in size=sm (kompakter Ausloeser, Klasse
Nutzt: ui.icon ui.icon-button ui.avatar
Beispiele
Eigenschaften
| Prop | Typ | Default | Builder-Label |
|---|---|---|---|
| triggerAppearance | string: default | pill | "default" | Ausloeser-Form |
| menuLabel | string | "" | Name des Menues |
| menuVariant | string: default | panel | "default" | Menue-Art |
| itemSize | string: md | lg | "md" | Eintragshoehe |
| searchable | boolean | false | Suchfeld im Menue |
| searchPlaceholder | string | "" | Platzhalter der Suche |
| submitName | string | "" | Formularfeld der Eintraege (leer = Ereignis) |
| searchSource | string | "" | Fernsuche: Quelle |
| searchHref | string | "" | Fernsuche: Ziel ({id}) |
| searchHeading | string | "" | Fernsuche: Ueberschrift |
| searchMinChars | number | 3 | Fernsuche: Mindestzeichen |
| label * | string | — | Button-Beschriftung |
| items * | array | — | Menü-Einträge |
| color | string: | gray | red | orange | amber | green | teal | blue | violet | pink | "" | Farbpunkt am Ausloeser |
| icon | string | "" | Icon am Ausloeser (leer = keins) |
| menuTitle | string | "" | Kopfzeile im Menue (optional) |
| variant | string: secondary | primary | ghost | "secondary" | Button-Variante |
| align | string: start | end | "start" | Menü-Ausrichtung |
| padding | string: standard | none | sm | md | lg | xl | "standard" | Innenabstand (standard = Baustein-Wert) |
| margin | string: standard | none | sm | md | lg | xl | "standard" | Aussenabstand |
| border | string: standard | none | hairline | strong | "standard" | Rahmen |
| radius | string: standard | none | control | surface | pill | "standard" | Ecken-Rundung |
| textColor | string | "" | Textfarbe (Token; leer = Standard) |
| backgroundColor | string | "" | Hintergrundfarbe (Token; leer = Standard) |
| shadow | string: standard | none | sm | md | lg | "standard" | Schatten |
| width | string: standard | full | "standard" | Breite |
| alignSelf | string: standard | start | center | end | "standard" | Ausrichtung im Elternteil |
| anchor | string | "" | Anker-ID (Sprungziel, z. B. fuer Nav-Links) |
| iconOnly | boolean | false | Nur Symbol |
| size | string: sm | md | "md" | Groesse des Ausloesers |
| triggerTone | string: default | inverse | "default" | Ausloeser-Ton (inverse = auf dunkler Flaeche) |
| chevron | boolean | true | Chevron am Ausloeser |
* Pflicht-Prop
Events & Slots
Events:
⚡ select⚡ open⚡ close — im Surface per on: {<event>: {action, params}} verdrahtbar.
Slot trigger:
akzeptiert ui.*
Slot panel:
akzeptiert ui.*, component.*, layout.*
Stellschrauben (Komponenten-Tokens)
Ebene 3 — aus dem CSS generiert (Registry). Umverdrahtbar per Hüllen-Komposition, ohne Markup-Eingriff; künftige Regler-Quelle des Component Builders.
| Token | Default |
|---|---|
--dropdown-action-on-primary | var(--color-action-on-primary) |
--dropdown-action-on-secondary | var(--color-action-on-secondary) |
--dropdown-action-primary | var(--color-action-primary) |
--dropdown-action-primary-hover | var(--color-action-primary-hover) |
--dropdown-action-secondary | var(--color-action-secondary) |
--dropdown-action-secondary-hover | var(--color-action-secondary-hover) |
--dropdown-border-default | var(--color-border-default) |
--dropdown-elevation-overlay | var(--elevation-overlay) |
--dropdown-focus-ring-color | var(--focus-ring-color) |
--dropdown-focus-ring-offset | var(--focus-ring-offset) |
--dropdown-focus-ring-width | var(--focus-ring-width) |
--dropdown-radius-control | var(--radius-control) |
--dropdown-radius-sm | var(--shape-small, var(--radius-control, var(--radius-sm))) |
--dropdown-status-danger | var(--color-status-danger) |
--dropdown-status-danger-surface | var(--color-status-danger-surface) |
--dropdown-surface-overlay | var(--color-surface-overlay) |
--dropdown-text-default | var(--color-text-default) |
--dropdown-text-link | var(--color-text-link) |
--dropdown-menu-min-width | calc(var(--size-20) * 2) |
--menu-item-height | var(--size-10) |
--menu-item-font-size | var(--text-sm) |
Genutzte Design-Tokens
LLM-Notizen
# component.dropdown
Auslöser-Button mit Aktionsmenü; Outside-Click und Escape schließen es.
## Wann nutzen
- Für ein kompaktes Aktionsmenü an einem Button.
- Nicht für globale Suche (`component.command-menu`) oder Rechtsklick-Menüs (`component.context-menu`).
## Wichtige Props
- `label`* = Button-Beschriftung
- `items`* = Array aus `{value, label, icon?, tone? (default|danger), hint?, active?}` oder `{divider: true}`
- 1.20.0 (28.10.2026, opt-in, nex, wingQ-Chat): `items[].hint` = kleiner gedaempfter Zusatztext rechts neben der Beschriftung (im Panel-Menue darunter);
`items[].active` = aktueller Eintrag mit Haken am Zeilenende, `aria-current` und Klasse `invisible-dropdown__item--active` - statt "(aktuell)" im Label (Luecke 36).
- `variant` = Button-Variante, Enum `secondary` | `primary` | `ghost` (Default `secondary`)
- `iconOnly` = nur ein Symbol als Auslöser (`ui.icon-button` mit `icon`, sonst `menu`); `label` bleibt der zugängliche Name. Seit 1.21.0 gilt `variant` dort
vollständig (auch `primary`; bis 1.20 wurde daraus `secondary`).
- `align` = Menü-Ausrichtung, Enum `start` | `end` (Default `start`)
## Beispiel-Node
{ "definition": "component.dropdown", "props": { "label": "Aktionen", "variant": "secondary", "items": [ { "value": "edit", "label": "Bearbeiten", "icon": "pencil" }, { "divider": true }, { "value": "delete", "label": "Löschen", "tone": "danger" } ] } }
## Hinweise
- Props dürfen zur Laufzeit wechseln, auch `iconOnly` (seit 1.20.1; der Auslöser wird dabei ausgetauscht, ein offenes Menü schließt mit `close`) - kein `{#key}` nötig.
- Emittiert `select` (semantisch) beim Eintrag sowie `open`/`close`; `label` im select-Ereignis ist nur die Beschriftung (ohne hint).
- `items[].download: true` (1.22.0, mit `href`): Eintrag laedt eine Datei (Export, Herunterladen) - `download data-sveltekit-reload` am Link, damit der SvelteKit-Router ihn nicht als Seitenwechsel abfaengt. Bei unsicherem Link (Rueckfall `#`) ohne.