glaze/basecoat/combobox
Basecoat documentation: https://basecoatui.com/components/combobox/
A text input that filters a list of options as you type. Requires Basecoat’s JavaScript.
Options, groups and separators come from glaze/basecoat/select. The
selected value is submitted through a hidden input named name.
Recipe
import glaze/basecoat/combobox
import glaze/basecoat/select
import lustre/element/html
fn framework() {
combobox.combobox("framework", "framework", "Select framework...", "No framework found.", [], [
select.option("next", [], [html.text("Next.js")]),
select.option("astro", [], [html.text("Astro")]),
])
}
Values
pub fn auto_highlight() -> attribute.Attribute(msg)
Highlight the first matching option while typing. Put this in attrs.
pub fn close_on_select() -> attribute.Attribute(msg)
For combobox_multiple: close the list after
each pick. Put this in attrs.
pub fn combobox(
id: String,
name: String,
placeholder: String,
empty_message: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
empty_message is shown when no option matches the input.
pub fn combobox_multiple(
id: String,
name: String,
placeholder: String,
empty_message: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
Lets the user pick several options, shown as chips. The hidden input holds a JSON array of the selected values.