---
title: "Composant ComboBox — zenit Zig UI"
description: "Une saisie avec recherche et filtrage qui réécrit sa valeur. Le tampon de saisie, le filtrage, l'overlay, l'option active et la valeur finale sont gérés par…"
url: https://zenit.z.express/fr/components/combobox
language: fr
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_de: https://zenit.z.express/de/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`

Une saisie avec recherche et filtrage qui réécrit sa valeur.

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

**BEHAVIOR CONTRACT**

Le tampon de saisie, le filtrage, l'overlay, l'option active et la valeur finale sont gérés par étapes distinctes.

**RECORDED INTERACTION**

Le harness tape « ap » et les résultats filtrés apparaissent.

`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;
}
```

[Voir le code sur GitHubexamples/storybook/stories.zig:3113](https://github.com/version-next/zenit/blob/HEAD/examples/storybook/stories.zig#L3113)

Le code source tel quel de la story dans le Storybook (zenit 5f9add5+wip 2026-09-30). `W` désigne `ui.widgets` ; `col` / `row` / `label` sont de petits helpers de mise en page du Storybook.

### 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
```

| Champ | Type | Défaut | Description |
| --- | --- | --- | --- |
| `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)

| Champ | Type | Défaut | Description |
| --- | --- | --- | --- |
| `wrapper` | `*Node` | — | — |
| `input` | `*Node` | — | Input wrapper（含 label） |
| `panel` | `*Node` | — | — |
| `is_open` | `*Signal(bool)` | — | — |
| `state` | `*ComboBoxState` | — | — |
