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

Fully styled select component for the forms

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 - Well, disabled
  • 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 iinvalid
  • is_multiple :boolean - If field does support multiselect, multiple attribute for select tag in HTML terms
  • is_open :boolean - Should dropdown be open

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

Summary

Functions

Callback implementation for Surface.Component.render/1.