View Source Moon.Design.Search (Moon v2.89.1)

Textinput with search options. Renders as a Moon.Design.Dropdown. Is designed for usage outside of the forms

Properties

  • options :list, required: true - ... format: [page: Module.Name, key: "Name"]
  • disabled :boolean - Set disabled/non-disabled
  • prompt :string - Some prompt to be shown on empty value
  • id :string, required: true - Id of the component
  • 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
  • testid :string - Data-testid attribute value
  • error :boolean, from_context: :error - Some additional styling will be set to indicate field is invalid
  • is_open :boolean - Should dropdown be open
  • filter :string - Filtering value for the options, appears in input
  • attrs :map, default: %{} - Additional attributes for the option link
  • no_results_label :string, default: "Search for" - Label to use in the beginning in case of no results

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
  • no_result - When no results are found - this slot will be rendered

Events

  • on_keyup - On key up event for the input - use it for filter options
  • on_change - Event that fires when smth is chosen from the dropdown menu

Summary

Functions

Callback implementation for Surface.Component.render/1.