Halogen.Widgets.Select
- Package
- purescript-halogen-widgets
- Repository
- afcondon/purescript-halogen-widgets
A controlled single-select dropdown, optionally typeahead-filtered, with three presentations of the same option data:
- flat (
defaultInput) — one un-headed list. - grouped (
groupedInput) — named groups inline, non-selectable headers over indented leaves. - cascade (
cascadingInput,cascade = true) — the same groups as a macOS-style fly-out menu: top-level family rows, each hovering/keying open a submenu to the side. Hover-intent, click/touch open, full keyboard navigation, and viewport-edge flip are all handled inside the widget.
Two kinds of state, deliberately split (see CONTRACT.md):
selectedis CONTROLLED — it is app-meaningful, so the parent owns it andSelectedrequests a change.open,query, and the cascade interaction state (hovered,leafFocus,flipLeft) are EPHEMERAL — the widget owns them and never surfaces them.
#OptionGroup Source
type OptionGroup = { label :: String, options :: Array Option }A named group of options. The same data drives all three grouped
presentations (see cascade): inline headers, or fly-out submenus.
#Input Source
type Input = { cascade :: Boolean, disabled :: Boolean, groups :: Array OptionGroup, options :: Array Option, placeholder :: String, searchable :: Boolean, selected :: Maybe String }Two ways to supply options, and they coexist:
options— a flat, un-headed list (the original surface).groups— named sections. Whengroupsis non-empty the dropdown renders grouped; otherwise it falls back to the flatoptions.selectedis still a single controlled value resolved across both sources.
cascade chooses the grouped presentation: false (default) is the
inline grouped list; true is the fly-out submenu menu. No effect without
groups.
#defaultInput Source
defaultInput :: Array Option -> InputThe flat on-ramp, unchanged: groups defaults to [], so every existing
caller compiles and behaves exactly as before.
#groupedInput Source
groupedInput :: Array OptionGroup -> InputThe grouped on-ramp (inline list): named groups, headers over their leaves.
#cascadingInput Source
cascadingInput :: Array OptionGroup -> InputThe cascade on-ramp (fly-out submenus): named groups, each revealed as a
side popup on hover/click/keyboard. Same controlled selected and Selected
output as every other shape — only the panel interaction differs.
- Modules
- Halogen.
Widgets. Accordion. Internal - Halogen.
Widgets. Compare - Halogen.
Widgets. DoubleKnob - Halogen.
Widgets. Field - Halogen.
Widgets. HAccordion - Halogen.
Widgets. Knob - Halogen.
Widgets. Modal - Halogen.
Widgets. Motion - Halogen.
Widgets. Panel - Halogen.
Widgets. SegmentedControl - Halogen.
Widgets. Select - Halogen.
Widgets. Slider - Halogen.
Widgets. Stepper - Halogen.
Widgets. Style - Halogen.
Widgets. Toast - Halogen.
Widgets. Toggle - Halogen.
Widgets. VAccordion