Client-mode comboboxes toggle entirely in the browser (no HTTP on open/select); server-mode keeps an HTMX lazy/search path for options that can't be pre-rendered.
DefaultRendered example
Usage Example
// Client mode: options are pre-rendered, toggling happens in the browser.varIndustryCfg=combobox.Config{ID:"industry",Name:"industry",Label:"Industry",Mode:combobox.ModeSingle,Source:combobox.Source{Static:industryOptions},}@combobox.Combobox(IndustryCfg,combobox.State{Options:IndustryCfg.Source.Static})
Built-in text: the development API provides expressions.Combobox for application defaults, request preferences, and individual component overrides. Read the expression guide.
Client Multi-Select
Use arrow keys to move between enabled options, Enter or Space to select, and Escape to return to the trigger. Checkbox selection supports Clear all. Option.Trailing renders supporting content without changing the selected label. DisablePersistence lets server-rendered state own the selection after navigation.
Use a non-empty LazyEndpoint to select server mode, then set Toggle/Options/Clear endpoints for HTMX selection, search, and clearing. The current LazyEndpoint value is a mode marker; OptionsEndpoint is the URL actually requested. Updating a selection keeps the menu open and preserves your search draft.
DependsOn adds other fields to combobox HTMX requests. Add an hx-get on the parent field when changing it should immediately refresh the dependent options.
Cascading Server FiltersRendered example
No matches found
Cascading Server Filters
selectedProvider:="aws"varClusterCfg=combobox.Config{ID:"cluster",Name:"cluster",Mode:combobox.ModeSingle,EnableSearch:true,DependsOn:[]string{"provider"},ToggleEndpoint:"/api/.../clusters/toggle",OptionsEndpoint:"/api/.../clusters/options",ClearEndpoint:"/api/.../clusters/clear",Source:combobox.Source{LazyEndpoint:"/api/.../clusters/options"},}// OptionsProvider receives search and deps["provider"] on the server.clustersProvider:=func(ctxcontext.Context,searchstring,depsmap[string]string)([]combobox.Option,error){returnclustersForProvider(deps["provider"],search)}<selectname="provider"hx-get={ClusterCfg.OptionsEndpoint}hx-trigger="change"hx-target="#cluster-options"hx-swap="outerHTML"hx-include="#cluster [data-combobox-search], #cluster input[type=hidden]"><optionvalue={selectedProvider}>AWS</option></select>@combobox.Combobox(ClusterCfg,combobox.State{})
Go API
development
The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.
github.com/araihu/goshtoso/components/combobox
An exact external API link is added to versioned builds.
Goshtoso can store preferences and demo state in your browser. Some examples use cookies and IndexedDB to persist local demo state. There is no analytics, advertising, or third-party tracking. You can use the site without storage, but preferences and some examples will reset or stop persisting. Details in our Privacy Policy.