Segment-Schalter
Umschalter aus verbundenen Segmenten (genau eine Auswahl) — für Ansichts-/Modus-Wechsel; als Formularwert über das name-Feld, Tastatur mit Pfeiltasten. 1.1.0: Segmente optional mit Zaehler (count) und nur als Icon (iconOnly, Label fuer Screenreader). 1.2.0 opt-in: label/hint (Feld wie ui.input), fil
Nutzt: ui.icon
Beispiele
Eigenschaften
| Prop | Typ | Default | Builder-Label |
|---|---|---|---|
| options * | array | — | Segmente |
| value | string | "" | Ausgewählter Wert (leer = erstes Segment) |
| name | string | "" | Formular-Feldname (leer = kein hidden input) |
| size | string: sm | md | "md" | Größe |
| label | string | "" | Beschriftung |
| hint | string | "" | Hinweis |
| labelHidden | boolean | false | Beschriftung nur für Vorlesehilfen |
| fill | boolean | false | Volle Breite |
| 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) |
* Pflicht-Prop
Events & Slots
Events:
⚡ change — im Surface per on: {<event>: {action, params}} verdrahtbar.
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 |
|---|---|
--segmented-control-height | var(--control-height) |
--segmented-control-pad | var(--size-05) |
--segmented-control-radius | var(--radius-control, var(--shape-control)) |
--segmented-control-background | var(--color-surface-default) |
--segmented-control-border | var(--color-border-default) |
--segmented-control-color | var(--color-text-muted) |
--segmented-control-hover-background | color-mix(in srgb, var(--color-text-default) 6%, transparent) |
--segmented-control-hover-color | var(--color-text-default) |
--segmented-control-active-background | var(--color-text-default) |
--segmented-control-active-hover-background | color-mix(in srgb, var(--color-text-default) 88%, var(--color-surface-default)) |
--segmented-control-active-color | var(--color-surface-default) |
--segmented-control-count-background | color-mix(in srgb, var(--color-text-default) 8%, transparent) |
--segmented-control-count-color | var(--color-text-muted) |
--segmented-control-active-count-background | color-mix(in srgb, var(--color-surface-default) 20%, transparent) |
--segmented-control-active-count-color | var(--color-surface-default) |
Genutzte Design-Tokens
LLM-Notizen
component.segmented-control
Umschalter aus verbundenen Segmenten — genau eine Auswahl (Ansichts-/Modus-Wechsel: Liste|Board|Kalender, Monatlich|Jährlich). Abgrenzung: component.tabs wechselt INHALTE, der Segment-Schalter ist ein WERT (Event change {value}; name macht ihn per hidden input formular-tauglich).
Wichtige Props
options=[{value, label, icon?, count?, iconOnly?}](Pflicht),value(leer = erstes),name,size(sm|md).label/hint= Feld wieui.input(Beschriftung darüber, Hinweis darunter),fill= volle Breite.labelHidden: true(1.6.0):labelbleibt der zugängliche Name der Gruppe (aria-label), wird aber nicht sichtbar gezeichnet – für Werkzeugleisten und enge Zeilen. Immerlabelmitgeben, sonst hat die Gruppe keinen Namen. Ohnehintist dann die Gruppe selbst die Wurzel (keine Feld-Hülle).- Tastatur: Pfeil links/rechts. Stellschrauben:
--segmented-control-background,--segmented-control-active-background,--segmented-control-border.
Beispiel-Node
{
"definition": "component.segmented-control",
"props": { "options": [{"value": "list", "label": "Liste"}, {"value": "board", "label": "Board"}], "value": "board" }
}