ui/combobox

Types

pub type MenuTrigger {
  Input
  Focus
  Manual
}

Constructors

  • Input
  • Focus
  • Manual

Keyboard messages for combobox component.

pub type Msg {
  Open
  Close
  MoveNext
  MovePrev
  MoveFirst
  MoveLast
  Select
  TypeAhead(String)
  SelectAndClose
  Clear
}

Constructors

  • Open

    Open the dropdown (ArrowDown, ArrowUp, Alt+ArrowDown, Alt+ArrowUp)

  • Close

    Close the dropdown (Escape)

  • MoveNext

    Move to next option (ArrowDown)

  • MovePrev

    Move to previous option (ArrowUp)

  • MoveFirst

    Move to first option (Home)

  • MoveLast

    Move to last option (End)

  • Select

    Select the currently highlighted option (Enter)

  • TypeAhead(String)

    Type-ahead search (Character keys)

  • SelectAndClose

    Select and close (Enter)

  • Clear

    Clear the input (Escape when open)

pub type Size {
  Small
  Medium
  Large
}

Constructors

  • Small
  • Medium
  • Large
pub type Variant {
  Default
  Muted
}

Constructors

  • Default
  • Muted

Values

pub fn allows_custom_value() -> attribute.Attribute(a)
pub fn aria_activedescendant(
  id: String,
) -> attribute.Attribute(a)

Attribute to indicate the currently active descendant.

pub fn aria_controls(id: String) -> attribute.Attribute(a)

Attribute to indicate controls relationship.

pub fn aria_expanded(expanded: Bool) -> attribute.Attribute(a)

Attribute to indicate expanded state.

pub fn chevron_icon(
  attributes: List(attribute.Attribute(a)),
) -> element.Element(a)
pub fn combobox(
  attributes: List(attribute.Attribute(a)),
) -> element.Element(a)
pub fn disabled() -> attribute.Attribute(a)
pub fn empty_state(
  attributes: List(attribute.Attribute(a)),
) -> element.Element(a)
pub fn input_element_id() -> String

Get the element ID for the combobox input.

pub fn input_field(
  attributes: List(attribute.Attribute(a)),
) -> element.Element(a)
pub fn invalid() -> attribute.Attribute(a)
pub fn keymap(
  key_event: keyboard.KeyEvent,
  is_open: Bool,
) -> option.Option(Msg)

Keymap for combobox keyboard navigation. Follows WAI-ARIA combobox pattern:

  • ArrowDown/ArrowUp: Open dropdown and navigate
  • Alt+ArrowDown/Alt+ArrowUp: Open dropdown
  • Escape: Close dropdown
  • Enter: Select highlighted option
  • Character: Type-ahead search and filter
pub fn listbox(
  attributes: List(attribute.Attribute(a)),
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn listbox_element_id() -> String

Get the element ID for the combobox listbox.

pub fn option(
  attributes: List(attribute.Attribute(a)),
  label: String,
  option_value: String,
) -> element.Element(a)
pub fn option_element_id(index: Int) -> String

Get the element ID for a combobox option at the given index.

pub fn option_group(
  attributes: List(attribute.Attribute(a)),
  label: String,
  children: List(element.Element(a)),
) -> element.Element(a)
pub fn placeholder(placeholder: String) -> attribute.Attribute(a)
pub fn required() -> attribute.Attribute(a)
pub fn size(s: Size) -> attribute.Attribute(a)
pub fn value(val: String) -> attribute.Attribute(a)
Search Document