nano-ui
Safe HaskellNone
LanguageGHC2024

NanoUI.Widgets.Combo

Description

Combo box: a search field with a filtered, scrollable suggestion dropdown. The per-frame logic is the pure comboStep over a persisted ComboState.

Synopsis

Documentation

comboBox :: forall f (es :: [Effect]). (Foldable f, Ui :> es) => Text -> f Text -> Text -> Eff es Text Source #

Combo box: the searchField with a select-style dropdown of options. While the field holds focus, the shared select dropdown overlay lists the options filtered by the field text (all of them while it is empty). The value is free text: options are suggestions, not a closed set. See comboStep for when the value commits. Pass the current text; the result is the text after this frame, and respChanged on comboBox' marks a commit.

comboBox' :: forall f (es :: [Effect]). (Foldable f, Ui :> es) => Text -> f Text -> Text -> Eff es (Response, Text) Source #

data ComboState Source #

A combo's state between frames.

Constructors

ComboState 

Fields

Instances

Instances details
Eq ComboState Source # 
Instance details

Defined in NanoUI.Widgets.Combo

Show ComboState Source # 
Instance details

Defined in NanoUI.Widgets.Combo

data ComboInput Source #

One frame's inputs to comboStep.

Constructors

ComboInput 

Fields

data ComboStep Source #

What one frame of the combo decided.

Constructors

ComboStep 

Fields

comboStep :: ComboInput -> ComboState -> ComboStep Source #

One frame of the combo: highlight, scrolling, thumb drags, and commits.

Typing edits the live text but never commits it: the committed value only changes on Enter (which commits the highlighted row only), on a row click (a field text the combo did not produce), or when the field loses focus. Escape reverts the live text to the last committed value. Hover highlights a row and makes it the Enter target; Up/Down move the highlight.