Multiple (or single) choice drawn as pills inside the field, with a searchable list
under it. It is the LedgerUI.Components.Select listbox (multiple, search="panel")
and shares its hook, LedgerUI.Select (priv/static/ledger_ui/hooks/select.js).
<.pillbox field={@form[:categories]} label="Categories" options={@categories} />
<.pillbox name="tags" options={@tags} value={@chosen} create create_label="Create" />
<.pillbox name="branches" options={@branches} value={@chosen} overflow="wrap" />
<.pillbox name="product_id" value={@product_id} options={@products} multiple={false} />The pills are submitted as name[] (an empty name[] first, so an emptied field still
reaches the server); multiple={false} submits name. Each change fires a bubbling input
event for phx-change. readonly keeps the values in the form but takes the x, the chevron
and the list away; disabled also leaves them out of the form.
Options may carry :count (a faint mono number at the right of the row) and :color /
:initials (a person: the pill gets a 22px avatar).
Summary
Functions
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any) - Defaults tonil.field(Phoenix.HTML.FormField) - Defaults tonil.options(:list) - Defaults to[].selected_options(:list) - Defaults to[].label(:string) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].multiple(:boolean) - Defaults totrue.size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".panel_min_width(:string) - Defaults tonil.panel_class(:any) - Defaults tonil.placeholder(:string) - Defaults tonil.search_placeholder(:string) - Defaults to"Search…".overflow(:string) - Defaults to"one". Must be one of"one", or"wrap".create(:boolean) - Defaults tofalse.create_label(:string) - Defaults to"Create".create_hint(:string) - Defaults to"↵".empty_label(:string) - Defaults to"No results found".clear(:boolean) - Defaults tofalse.clear_label(:string) - Defaults to"Clear".remove_label(:string) - Defaults to"Remove".hidden_label(:string) - Defaults to"%{count} hidden".readonly(:boolean) - Defaults tofalse.disabled(:boolean) - Defaults tofalse.on_search(:string) - Defaults tonil.debounce(:integer) - Defaults to300.target(:any) - Defaults tonil.on_load_more(:string) - Defaults tonil.has_more(:boolean) - Defaults tofalse.loading_label(:string) - Defaults to"Loading…".open(:boolean) - Defaults tofalse.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["form", "required"].