plushie/widget/combo_box

Combo box widget builder (text field with suggestions dropdown).

Types

pub opaque type ComboBox

Option type for combo box properties.

pub type Opt {
  Placeholder(String)
  Width(length.Length)
  Padding(padding.Padding)
  Size(Float)
  Font(font.Font)
  LineHeight(line_height.LineHeight)
  MenuHeight(Float)
  Icon(node.PropValue)
  OnOptionHovered(Bool)
  OnOpen(Bool)
  OnClose(Bool)
  Shaping(shaping.Shaping)
  Ellipsis(String)
  MenuStyle(node.PropValue)
  OnSubmit(Bool)
  Style(String)
  Required(Bool)
  Validation(validation_state.ValidationState)
  A11y(a11y.A11y)
}

Constructors

Values

pub fn a11y(cb: ComboBox, a: a11y.A11y) -> ComboBox

Set accessibility properties for this widget.

pub fn build(cb: ComboBox) -> node.Node

Build the combo box into a renderable Node.

pub fn ellipsis(cb: ComboBox, e: String) -> ComboBox

Set the text ellipsis mode.

pub fn font(cb: ComboBox, f: font.Font) -> ComboBox

Set the font.

pub fn icon(cb: ComboBox, i: node.PropValue) -> ComboBox

Set a custom icon. Pass a DictVal with keys like code_point, size, font, etc.

pub fn line_height(
  cb: ComboBox,
  lh: line_height.LineHeight,
) -> ComboBox

Set the line height.

pub fn menu_height(cb: ComboBox, h: Float) -> ComboBox

Set the dropdown menu height.

pub fn menu_style(cb: ComboBox, ms: node.PropValue) -> ComboBox

Set dropdown menu style overrides. Pass a DictVal with optional keys: background, text_color, selected_text_color, selected_background, border, shadow.

pub fn new(
  id: String,
  options: List(String),
  value: String,
) -> ComboBox

Create a new combo box builder.

pub fn on_close(cb: ComboBox, enabled: Bool) -> ComboBox

Enable the close event.

pub fn on_open(cb: ComboBox, enabled: Bool) -> ComboBox

Enable the open event.

pub fn on_option_hovered(cb: ComboBox, enabled: Bool) -> ComboBox

Enable the option-hovered event.

pub fn on_submit(cb: ComboBox, enabled: Bool) -> ComboBox

Enable the submit event.

pub fn padding(cb: ComboBox, p: padding.Padding) -> ComboBox

Set the padding.

pub fn placeholder(cb: ComboBox, p: String) -> ComboBox

Set the placeholder text.

pub fn required(cb: ComboBox, r: Bool) -> ComboBox

Mark this field as required. Flows into a11y.required.

pub fn shaping(cb: ComboBox, s: shaping.Shaping) -> ComboBox

Set the text shaping strategy.

pub fn size(cb: ComboBox, s: Float) -> ComboBox

Set the size.

pub fn style(cb: ComboBox, s: String) -> ComboBox

Set the style.

pub fn validation(
  cb: ComboBox,
  v: validation_state.ValidationState,
) -> ComboBox

Set the form-validation state.

pub fn width(cb: ComboBox, w: length.Length) -> ComboBox

Set the width.

pub fn with_opts(cb: ComboBox, opts: List(Opt)) -> ComboBox

Apply a list of options to a combo box builder.

Search Document