View Source Moon.Design.Form.Combobox (Moon v2.89.1)

Fully customized select component for the forms with input for filtering

Properties

  • field :atom, from_context: {Form.Field, :field} - Name of the field, usually should be taken from context
  • form :form, from_context: {Form, :form} - Form info, usually should be taken from context
  • options :list, required: true - ... format: [%{key: shown_label, value: option_value, disabled: bool}], diisabled is optional
  • value :any - Selected option(s) value - do not use it inside the form, just for away-from-form components
  • disabled :boolean - HTML disabled attribute for the input & some additional classes
  • size :string, values!: ~w(sm md lg), default: "md" - Common moon size property
  • class :css_class, from_context: :class - Additional classes for the <select> tag
  • prompt :string - Some prompt to be shown on empty value
  • id :string - Id to be given to the select tag
  • testid :string - Data-testid attribute value
  • error :boolean, from_context: :error - Some additional styling will be set to indicate field is invalid
  • is_multiple :boolean - If field does support multiselect, multiple attribute for select tag in HTML terms
  • is_open :boolean - Should dropdown be open
  • attrs :any, default: %{} - Keyword | Map of additional attributes for the input

  • filter :string - Filtering value for the options

Slots

  • default - Option for custom stylings - use it to show icons or anything else
  • trigger - Trigger element for the dropdown, default is Dropdown.Select
  • option - Slot used for rendering single option. option[:key] will be used if not given

Events

  • on_keyup - On key up event for the input - use it for filter options outside the form
  • on_focus
  • on_blur

Summary

Functions

Callback implementation for Surface.Component.render/1.