Combo box

A combo box offers suggested values while allowing people to enter a value of their own. It suits fields where common choices save typing but the list cannot cover every valid answer.

day-pieces binds the text and suggestion list to app state. For a choice restricted to listed values, use a picker.

Add to your app

This control is included in day-pieces and re-exported through day::prelude::*. No additional crate or control feature is required. The selected toolkit supplies its native implementation; day::combobox::support() reports its availability after the Day runtime starts.

Platforms / toolkitsAvailability
AppKit, GTK, Qt, Android, WinUINative editable choice control.
WebBrowser input with a datalist.
ArkUIComposed text input and suggestions menu.
UIKitNo renderer; use a picker or text field.

The UI snippets use generated res::str accessors from an app’s Fluent catalog; see the example messages and catalog setup.

Authoring

use day::combobox::combo_box;

// Synthetic suggestions stand in for user-supplied data.
let flavors = Signal::new(vec!["vanilla".into(), "chocolate".into()]);
let flavor = Signal::new(String::new());
combo_box(flavors, flavor)
    .placeholder(res::str::type_or_pick_a_flavor())
    .id(id!(flavor))

combo_box(items, text) binds text two-way: typing updates the signal, picking a dropdown item writes the item’s string, and setting the signal updates the control. items is reactive: a change patches the native dropdown live, and the typed text survives the swap. .placeholder(impl IntoText) sets the empty-state prompt (read once at build). ComboBox implements Piece, so .id()/.a11y()/.frame() chain via Decorate. Like text_field it is a width-growing leaf (grow_w = true, natural single-line height).

Toolkit implementations

Platform guidance: Apple: pickers; Android: spinners; Windows: combo boxes.

Platform / toolkitImplementation
AppKitNSComboBox
GTKGtkComboBoxText with entry
QtEditable QComboBox
AndroidAutoCompleteTextView
WinUIEditable ComboBox
UIKitNo renderer; placeholder only.
WebBrowser input with a datalist.
ArkUIArkTS TextInput + suggestions menu.

On UIKit, use a picker or text field. ArkUI composes a text input and suggestions menu. AppKit completes text inline; Android prefix-filters suggestions while typing.

WinUI commits free-form text on Enter or focus loss; choosing a suggestion updates the binding immediately. Other implementations report text edits as they occur.

Limits

The placeholder is read when the control is built. The builder does not provide a separate submit callback, enabled binding, or maximum-visible-items setting.