---
title: "ComboBox-Komponente — zenit Zig UI"
description: "Eine durchsuchbare, filterbare Eingabe, die ihren Wert zurückschreibt. Eingabepuffer, Filterung, Overlay, aktive Option und endgültiger Wert werden in…"
url: https://zenit.z.express/de/components/combobox
language: de
alternate_en: https://zenit.z.express/components/combobox.md
alternate_zh: https://zenit.z.express/zh/components/combobox.md
alternate_es: https://zenit.z.express/es/components/combobox.md
alternate_ja: https://zenit.z.express/ja/components/combobox.md
alternate_ko: https://zenit.z.express/ko/components/combobox.md
alternate_fr: https://zenit.z.express/fr/components/combobox.md
project: zenit v0.1.0-alpha (Zig 0.15.2, macOS)
source: https://github.com/version-next/zenit
---

# ComboBox

`ui.widgets.ComboBox`

Eine durchsuchbare, filterbare Eingabe, die ihren Wert zurückschreibt.

[Video](https://zenit.z.express/media/stories/combobox.mp4?v=f15dabefd2)

**BEHAVIOR CONTRACT**

Eingabepuffer, Filterung, Overlay, aktive Option und endgültiger Wert werden in getrennten Stufen verwaltet.

**RECORDED INTERACTION**

Der Harness tippt „ap“ und die gefilterten Ergebnisse erscheinen.

`examples/storybook/stories.zig:3113`

```zig
// ── ComboBox / Autocomplete ──
pub fn buildComboBox(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const a = cx.allocator;
    const c = try col(cx, 12);
    const opts = [_]ui.widgets.ComboOption{
        .{ .value = "ap", .label = "Apple" },
        .{ .value = "ba", .label = "Banana" },
        .{ .value = "ch", .label = "Cherry" },
        .{ .value = "gr", .label = "Grape" },
        .{ .value = "ma", .label = "Mango" },
    };
    const cb = try ui.widgets.ComboBox(.{
        .options = &opts,
        .label_text = "Fruit",
        .placeholder = "Type to search fruit",
        .width = 260,
    }, scope, cx);
    cb.input.meta.ownership.meta.test_id = "story.combobox.input";
    cb.panel.meta.ownership.meta.test_id = "story.combobox.panel";
    try c.appendChild(a, cb.wrapper);
    return c;
}
```

[Quellcode auf GitHub ansehenexamples/storybook/stories.zig:3113](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L3113)

Der unveränderte Quellcode der Story aus dem Storybook (zenit 5f9add5+wip 2026-09-30). `W` steht für `ui.widgets`; `col` / `row` / `label` sind kleine Layout-Helfer des Storybooks.

### ComboBoxProps

`ui.widgets.ComboBox`

[src/ui/components/combo\_box/mod.zig:47](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/combo_box/mod.zig#L47)

```zig
fn mountComboBox(props: ComboBoxProps, scope: *Scope, cx: *Cx) !ComboBoxMount
```

| Feld | Typ | Standard | Beschreibung |
| --- | --- | --- | --- |
| `options` | `[]const ComboOption` | `&.{}` | — |
| `placeholder` | `[]const u8` | `"Type to search…"` | — |
| `label_text` | `?[]const u8` | `null` | — |
| `width` | `f32` | `240` | — |
| `max_dropdown_height` | `f32` | `280` | — |
| `disabled` | `bool` | `false` | — |
| `on_change` | `?core.HandlerRef` | `null` | 选中提交回调；caller 在回调里读 state.selectedOption() |

### ComboBoxMount

`ui.widgets.ComboBox`

[src/ui/components/combo\_box/mod.zig:110](https://github.com/version-next/zenit/blob/HEAD/src/ui/components/combo_box/mod.zig#L110)

| Feld | Typ | Standard | Beschreibung |
| --- | --- | --- | --- |
| `wrapper` | `*Node` | — | — |
| `input` | `*Node` | — | Input wrapper（含 label） |
| `panel` | `*Node` | — | — |
| `is_open` | `*Signal(bool)` | — | — |
| `state` | `*ComboBoxState` | — | — |
