glaze/basecoat/command
Basecoat documentation: https://basecoatui.com/components/command/
Fast, composable command menu for quick navigation and actions.
Note: This component requires JavaScript from Basecoat.
Anatomy
A command menu usually includes a search input and a menu of items grouped into sections.
Recipe
import glaze/basecoat/command
import lustre/element/html
fn my_command() {
command.command("my-command", [], [
command.group("Suggestions", [
command.item([], [html.text("Calendar")]),
command.item([], [html.text("Search Emoji")]),
]),
])
}
References
- MDN ARIA
comboboxrole: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/combobox_role - MDN ARIA
menurole: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menu_role - MDN ARIA
menuitemrole: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Roles/menuitem_role - MDN
<dialog>: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog
Values
pub fn close_script(dialog_id: String) -> String
pub fn command(
id: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn command_styled(
id: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn dialog(
id: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn disabled() -> attribute.Attribute(msg)
pub fn filter(text: String) -> attribute.Attribute(msg)
pub fn force_show() -> attribute.Attribute(msg)
pub fn group(
label: String,
items: List(element.Element(msg)),
) -> element.Element(msg)
pub fn header(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn item(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn item_disabled(
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn item_link(
href: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn item_with_shortcut(
shortcut: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn keywords(text: String) -> attribute.Attribute(msg)
pub fn menu(
id: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn menu_with_empty(
id: String,
empty_message: String,
attrs: List(attribute.Attribute(msg)),
children: List(element.Element(msg)),
) -> element.Element(msg)
pub fn open_script(dialog_id: String) -> String
pub fn search_input(
id: String,
placeholder: String,
menu_id: String,
attrs: List(attribute.Attribute(msg)),
) -> element.Element(msg)
pub fn separator() -> element.Element(msg)